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:
parent
1c97a29a56
commit
78d55f0e32
1 changed files with 4 additions and 5 deletions
|
@ -12,7 +12,7 @@
|
||||||
use std::char::from_u32;
|
use std::char::from_u32;
|
||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
use std::iter::Peekable;
|
use std::iter::Peekable;
|
||||||
use std::ops::Range;
|
use std::ops::RangeInclusive;
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn unescape_char(c: char) -> char {
|
fn unescape_char(c: char) -> char {
|
||||||
|
@ -64,7 +64,7 @@ impl<'a> Iterator for Unescape<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct ExpandSet<'a> {
|
pub struct ExpandSet<'a> {
|
||||||
range: Range<u32>,
|
range: RangeInclusive<u32>,
|
||||||
unesc: Peekable<Unescape<'a>>,
|
unesc: Peekable<Unescape<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,9 +97,8 @@ impl<'a> Iterator for ExpandSet<'a> {
|
||||||
self.unesc.next(); // this is the '-'
|
self.unesc.next(); // this is the '-'
|
||||||
let last = self.unesc.next().unwrap(); // this is the end of the range
|
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]
|
#[inline]
|
||||||
pub fn new(s: &'a str) -> ExpandSet<'a> {
|
pub fn new(s: &'a str) -> ExpandSet<'a> {
|
||||||
ExpandSet {
|
ExpandSet {
|
||||||
range: 0..0,
|
range: 0..=0,
|
||||||
unesc: Unescape { string: s }.peekable(),
|
unesc: Unescape { string: s }.peekable(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue