mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
expand: refactor/polish ~ simplify if condition
This commit is contained in:
parent
ecb8f2873a
commit
84f05f209c
1 changed files with 1 additions and 6 deletions
|
@ -88,12 +88,7 @@ impl<'a> Iterator for ExpandSet<'a> {
|
||||||
|
|
||||||
if let Some(first) = self.unesc.next() {
|
if let Some(first) = self.unesc.next() {
|
||||||
// peek ahead
|
// peek ahead
|
||||||
if self.unesc.peek() == Some(&'-')
|
if self.unesc.peek() == Some(&'-') && self.unesc.size_hint().0 > 1 {
|
||||||
&& match self.unesc.size_hint() {
|
|
||||||
(x, _) if x > 1 => true, // there's a range here; record it in our internal Range struct
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
{
|
|
||||||
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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue