-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingC-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when appliedL-suggestionLint: Improving, adding or fixing lint suggestionsLint: Improving, adding or fixing lint suggestions
Description
fn lol(x: Box<[u8]>) {
unimplemented!();
}
warning: local variable doesn't need to be boxed here
--> src/lib.rs:1:8
|
1 | fn lol(x: Box<[u8]>) {
| ^
|
= note: `#[warn(clippy::boxed_local)]` on by default
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#boxed_local
This is kind of an interesting case; the suggestion isn't wrong per se, but it's definitely not optimal. The lint explainer as currently worded strongly suggests "an unboxed T
would work fine", whereas with ?Sized
values this obviously cannot be done. The owned value has to be boxed or otherwise behind an indirection.
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingC-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when appliedL-suggestionLint: Improving, adding or fixing lint suggestionsLint: Improving, adding or fixing lint suggestions