-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 have
Description
Lint name: collapsible_span_lint_calls
I tried this code:
span_lint_and_then(
cx,
UNINIT_VEC,
vec![call_span, maybe_with_capacity_or_reserve.span],
"calling `set_len()` immediately after reserving a buffer creates uninitialized values",
|diag| {
diag.help("initialize the buffer or wrap the content in `MaybeUninit`");
},
);Clippy suggests to collapse this into span_lint_and_help(). However, this is not possible because span_lint_and_then() takes S: Into<MultiSpan> while span_lint_and_help() only takes Span.
The issue can be easily fixed by either
(1) checking the type of the span and suppress the lint if it is not Span
(2) modifying the signature of span_lint_and_help() to accept Into<MultiSpan>
Meta
Rust version (rustc -Vv):
rustc 1.57.0-nightly (fdf65053e 2021-09-07)
binary: rustc
commit-hash: fdf65053e99e8966f9bd83b5a8491326cb33d638
commit-date: 2021-09-07
host: x86_64-unknown-linux-gnu
release: 1.57.0-nightly
LLVM version: 13.0.0
xFrednet
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 have