-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveL-suggestionLint: Improving, adding or fixing lint suggestionsLint: Improving, adding or fixing lint suggestionsS-needs-discussionStatus: Needs further discussion before merging or work can be startedStatus: Needs further discussion before merging or work can be startedgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
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
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveL-suggestionLint: Improving, adding or fixing lint suggestionsLint: Improving, adding or fixing lint suggestionsS-needs-discussionStatus: Needs further discussion before merging or work can be startedStatus: Needs further discussion before merging or work can be startedgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy