mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 20:17:45 +00:00
refactor/polish ~ fix cargo clippy
complaints (fix/remove allow range_plus_one)
This commit is contained in:
parent
1c97a29a56
commit
78d55f0e32
1 changed files with 4 additions and 5 deletions
|
@ -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(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue