diff options
-rw-r--r-- | src/delta.rs | 2 | ||||
-rw-r--r-- | src/parse.rs | 6 |
2 files changed, 3 insertions, 5 deletions
diff --git a/src/delta.rs b/src/delta.rs index 608b89c9..ac820de7 100644 --- a/src/delta.rs +++ b/src/delta.rs @@ -113,7 +113,7 @@ impl<'a> StateMachine<'a> { let mut handled_line = if line.starts_with("commit ") { self.handle_commit_meta_header_line()? - } else if self.state == State::CommitMeta && line.starts_with(" ") { + } else if self.state == State::CommitMeta && line.starts_with(' ') { self.handle_diff_stat_line()? } else if line.starts_with("diff ") { self.handle_file_meta_diff_line()? diff --git a/src/parse.rs b/src/parse.rs index a90323c3..167ae272 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -94,15 +94,13 @@ pub fn relativize_path_in_diff_stat_line( { if let Some(relative_path) = relative_path.to_str() { let suffix = caps.get(2).unwrap().as_str(); - let pad_width = diff_stat_align_width - .checked_sub(relative_path.len()) - .unwrap_or(0); + let pad_width = diff_stat_align_width.saturating_sub(relative_path.len()); let padding = " ".repeat(pad_width); return Some(format!(" {}{}{}", relative_path, padding, suffix)); } } } - return None; + None } pub fn get_file_extension_from_file_meta_line_file_path(path: &str) -> Option<&str> { |