Skip to content

Commit

Permalink
Fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
great-houk committed Aug 5, 2024
1 parent 1a9631b commit 07f16e3
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/argument_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ pub fn expand_files(args: &[String]) -> Vec<String> {
for arg in args {
if let Some(arg) = arg.strip_prefix('@') {
// The normal linker was able to open the file, so this *should* never panic
let file = File::open(arg).expect(&format!(
"Unable to open {arg}, this should never happen and should be reported"
));
let file = File::open(arg).unwrap_or_else(|e| {
panic!("Unable to open {arg}, this should never happen and should be reported: {e}")
});
let reader = BufReader::new(file);
for line in reader.lines() {
// Same as above, normal linker succeeded so we should too
let line = line.expect(&format!(
"Invalid file {arg}, this should never happen and should be reported"
));
let line = line.unwrap_or_else(|e| {
panic!(
"Invalid file {arg}, this should never happen and should be reported: {e}"
)
});
// Remove quotes if they exist
if line.starts_with('"') && line.ends_with('"') {
expanded.push(line[1..line.len() - 1].to_owned());
Expand Down

0 comments on commit 07f16e3

Please sign in to comment.