Use more elegant saturating_sub

This commit is contained in:
Alexandre Bury 2017-08-01 09:47:08 -07:00
parent d2f2f642c1
commit b021458352

View File

@ -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
};