Closed
Description
At least I can't make sense of it:
warning: some ranges overlap
--> pdf/src/primitive.rs:187:17
|
187 | b' ' ..= b'~' => write!(f, "{}", b as char)?,
| ^^^^^^^^^^^^^
|
= note: `#[warn(clippy::match_overlapping_arm)]` on by default
note: overlaps with this
--> pdf/src/primitive.rs:186:17
|
186 | b'"' => write!(f, "\\\"")?,
| ^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_overlapping_arm
The code:
for &b in &self.data {
match b {
b'"' => write!(f, "\\\"")?,
b' ' ..= b'~' => write!(f, "{}", b as char)?,
o @ 0 ..= 7 => write!(f, "\\{}", o)?,
x => write!(f, "\\x{:02x}", x)?
}
}
Obviously I want the second arm only when the first arm was not matched.
Meta
cargo clippy -V
: clippy 0.0.212 (de521cb 2020-08-21)rustc -Vv
:
rustc 1.47.0-nightly (de521cbb3 2020-08-21)
binary: rustc
commit-hash: de521cbb303c08febd9fa3755caccd4f3e491ea3
commit-date: 2020-08-21
host: x86_64-unknown-linux-gnu
release: 1.47.0-nightly
LLVM version: 10.0