diff options
author | Dan Davison <dandavison7@gmail.com> | 2021-11-27 18:30:05 -0500 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2021-11-29 08:41:24 -0500 |
commit | 0f66f753d0fadec50e957a655dbdc1e3c0ad08d1 (patch) | |
tree | 4dd5eb7f180821830627111e44fcc877c9f29b62 | |
parent | 67df50c8a8f8f1068a5bfbc02aa2ac38e601cd75 (diff) |
Refactor: is_in_hunk
-rw-r--r-- | src/handlers/hunk.rs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/handlers/hunk.rs b/src/handlers/hunk.rs index 201068eb..e2aea705 100644 --- a/src/handlers/hunk.rs +++ b/src/handlers/hunk.rs @@ -3,19 +3,13 @@ use crate::delta::{State, StateMachine}; use crate::style; use unicode_segmentation::UnicodeSegmentation; -impl State { - fn is_in_hunk(&self) -> bool { - matches!( - *self, - State::HunkHeader(_, _) | State::HunkZero | State::HunkMinus(_) | State::HunkPlus(_) - ) - } -} - impl<'a> StateMachine<'a> { #[inline] fn test_hunk_line(&self) -> bool { - self.state.is_in_hunk() + matches!( + self.state, + State::HunkHeader(_, _) | State::HunkZero | State::HunkMinus(_) | State::HunkPlus(_) + ) } /// Handle a hunk line, i.e. a minus line, a plus line, or an unchanged line. |