From b021458352b539c5b00d3949609eef9ad44e7358 Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Tue, 1 Aug 2017 09:47:08 -0700 Subject: [PATCH] Use more elegant saturating_sub --- src/utils/lines_iterator.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/utils/lines_iterator.rs b/src/utils/lines_iterator.rs index 65de257..ccf7090 100644 --- a/src/utils/lines_iterator.rs +++ b/src/utils/lines_iterator.rs @@ -99,11 +99,8 @@ impl<'a> Iterator for LinesIterator<'a> { let content = &content[..next]; let allowed_width = if self.show_spaces { - if self.width < 1 { - 0 - } else { - self.width - 1 - } + // Remove 1 from the available space, if possible. + self.width.saturating_sub(1) } else { self.width };