Skip to content

Commit

Permalink
fix clippy lint for constant is_empty check, combine writes
Browse files Browse the repository at this point in the history
as far as I can tell, it doesn't really hurt to write an empty string if DELIM
is empty. the only reason to check is that the user could modify the config rust
file, and you don't want them to have to modify this code too
  • Loading branch information
ntBre committed May 2, 2024
1 parent 4dc9f35 commit c240083
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions blocks/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,8 @@ impl Block {
return String::new();
}
};
write!(output, "{}", String::from_utf8(out.stdout).unwrap()).unwrap();
if !DELIM.is_empty() {
write!(output, "{}", DELIM).unwrap();
}
write!(output, "{}{DELIM}", String::from_utf8(out.stdout).unwrap())
.unwrap();
output
}
}
Expand Down

0 comments on commit c240083

Please sign in to comment.