aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.rs2
-rw-r--r--src/rope.rs6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs
index 3663052..66976fc 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -21,7 +21,7 @@ fn line_offset(stdin: &mut Reader, line: &Rope, col: u16) -> Result<usize, Box<d
return Ok(i);
}
let c = line.byte(i);
- if !(c == b'\t' || b' ' <= c && c <= b'~') {
+ if !(c == b'\t' || (b' '..=b'~').contains(&c)) {
break;
}
if n == col {
diff --git a/src/rope.rs b/src/rope.rs
index f22d103..01867f8 100644
--- a/src/rope.rs
+++ b/src/rope.rs
@@ -164,7 +164,7 @@ impl Rope {
b.children[(MAX_CHILDREN + 1) / 2..MAX_CHILDREN - 1]
.iter()
.cloned()
- .chain([child1, child2].into_iter()),
+ .chain([child1, child2]),
),
);
}
@@ -172,7 +172,7 @@ impl Rope {
b.children[..b.children.len() - 1]
.iter()
.cloned()
- .chain([child1, child2].into_iter()),
+ .chain([child1, child2]),
));
}
}
@@ -351,7 +351,7 @@ impl Rope {
if c < ' ' || c == '\x7f' {
let b = u8::try_from(c).expect("c should be less than \\x7f");
write!(w, "\x1b[36m^{}\x1b[m", char::from(b ^ 0x40))?;
- } else if '\u{80}' <= c && c <= '\u{9f}' {
+ } else if ('\u{80}'..='\u{9f}').contains(&c) {
write!(w, "\x1b[36m<{:x}>\x1b[m", u32::from(c))?;
} else {
write!(w, "{}", c)?;