Skip to content

Commit

Permalink
Format (#43)
Browse files Browse the repository at this point in the history
Fix formatting issue
  • Loading branch information
IogaMaster committed Sep 27, 2023
1 parent 796ee83 commit 74dedb4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ pub(crate) fn add_newline_at_end_of_file(out: Vec<u8>) -> Vec<u8> {
/// and afterwards include the new lines and indentation correctly
/// according to the configuration
fn trim_ascii_whitespace(x: &[u8]) -> &[u8] {
let Some(from) = x.iter().position(|x| !x.is_ascii_whitespace()) else { return &x[0..0] };
let Some(from) = x.iter().position(|x| !x.is_ascii_whitespace()) else {
return &x[0..0];
};
let to = x.iter().rposition(|x| !x.is_ascii_whitespace()).unwrap();
&x[from..=to]
}
Expand Down

0 comments on commit 74dedb4

Please sign in to comment.