1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-30 12:37:49 +00:00

refactor/polish ~ fix cargo clippy complaints (fix/remove allow range_plus_one)

This commit is contained in:
Roy Ivy III 2020-04-04 11:32:30 -05:00
parent 1c97a29a56
commit 78d55f0e32

View file

@ -12,7 +12,7 @@
use std::char::from_u32;
use std::cmp::min;
use std::iter::Peekable;
use std::ops::Range;
use std::ops::RangeInclusive;
#[inline]
fn unescape_char(c: char) -> char {
@ -64,7 +64,7 @@ impl<'a> Iterator for Unescape<'a> {
}
pub struct ExpandSet<'a> {
range: Range<u32>,
range: RangeInclusive<u32>,
unesc: Peekable<Unescape<'a>>,
}
@ -97,9 +97,8 @@ impl<'a> Iterator for ExpandSet<'a> {
self.unesc.next(); // this is the '-'
let last = self.unesc.next().unwrap(); // this is the end of the range
#[allow(clippy::range_plus_one)]
{
self.range = first as u32 + 1..last as u32 + 1;
self.range = first as u32 + 1..=last as u32;
}
}
@ -114,7 +113,7 @@ impl<'a> ExpandSet<'a> {
#[inline]
pub fn new(s: &'a str) -> ExpandSet<'a> {
ExpandSet {
range: 0..0,
range: 0..=0,
unesc: Unescape { string: s }.peekable(),
}
}