[Experimental] <T as Into<T>>::into lint#129249
Conversation
|
r? @chenyukang rustbot has assigned @chenyukang. Use |
|
Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
|
@bors try @craterbot check |
|
@bors try |
This comment was marked as outdated.
This comment was marked as outdated.
|
@bors try |
[Experimental] `<T as Into<T>>::into` lint Running crater to see how common that pattern is. The Lint would have to be at most warn-by-default because there are a handful of cases detected that are actually perfectly reasonable (`type` aliases with per-platform `cfg`, or macros) which are now at best half-heartedly handled. I've detected a handful of cases where we're calling `.into()` unnecessarily in the `rustc` codebase as well, and changed those.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
💔 Test failed - checks-actions |
|
🤔 looks like you are reimplementing a subset of https://rust-lang.github.io/rust-clippy/master/index.html#/useless_conversion ? edit: spoiler |
|
looks a bit like a mix of |
This comment has been minimized.
This comment has been minimized.
|
@matthiaskrgr I'm trying to gauge how common the root cause of the recent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Some changes occurred in compiler/rustc_builtin_macros/src/autodiff.rs cc @ZuseZ4 |
This comment has been minimized.
This comment has been minimized.
|
The Cranelift subtree was changed cc @bjorn3 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
This is a pattern that I am currently not addressing and am tempted in not addressing in the logic: rust/library/std/src/sys/process/mod.rs Lines 1 to 22 in 4804ad7 The modules for different platforms are behind cfg_select/cfg, re-exported with the same name, and they define different types (not just aliases). I'll need to figure out how to detect this without severely increasing the number of false-negatives. Hopefully crater will let us know how prevalent these are, but suspect there won't be that many. If I can come up with reasonable logic that would not trigger with this case, we could have a second more lenient lint that is error by default. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
While working on rust-lang#129249, encountered these cases in the codebase of calling `.into()` unecessarily. Splitting them out so that they can land independently of the lint.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
The job Click to see the possible cause of the failure (guessed by this bot) |
View all comments
Running crater to see how common that pattern is. The Lint would have to be at most warn-by-default because there are a handful of cases detected that are actually perfectly reasonable (
typealiases with per-platformcfg, or macros) which are now at best half-heartedly handled.I've detected a handful of cases where we're calling
.into()unnecessarily in therustccodebase as well, and changed those.CC #127343.