Skip to content

Figure out where .unwrap() actually should be used #17

Description

@michardy

It can be bad practice to use unwrap as is panics on failure. There are several places where the code should warn but not panic. In other places a more descriptive panic method may be necessary.

Currently there are 26 invocations of .unwrap()

main.rs:343: let mut img = image::open(&Path::new(&path)).unwrap();
main.rs:701: ).unwrap();
main.rs:731: ).unwrap();
main.rs:762: ).unwrap();
main.rs:793: ).unwrap();
main.rs:803: ).unwrap();
main.rs:820: ).unwrap();
main.rs:825: ).unwrap();
main.rs:830: ).unwrap();
main.rs:838: ).unwrap();
main.rs:846: ).unwrap();
main.rs:854: ).unwrap();
main.rs:869: let f = (File::open(IMPORTED)).unwrap();
main.rs:872: let templ = line.unwrap();
main.rs:895: let start = numbers[0].parse::<usize>().unwrap();
main.rs:896: let end = numbers[1].parse::<usize>().unwrap();
main.rs:901: let i = sel.to_string().parse::<usize>().unwrap();
main.rs:907: let paths = fs::read_dir("./").unwrap();
main.rs:912: let path = p.unwrap().path();
main.rs:916: path.extension().unwrap() == "png" ||
main.rs:917: path.extension().unwrap() == "jpg" ||
main.rs:918: path.extension().unwrap() == "bpm" ||
main.rs:919: path.extension().unwrap() == "gif"
main.rs:921: mpaths.push(path.into_os_string().into_string().unwrap());//ugly hack but as_path().to_string() does not work
main.rs:1119: File::create(IMPORTED).unwrap();
main.rs:1125: .unwrap();

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions