-
Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
A-edition-2021Area: The 2021 editionArea: The 2021 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.
Description
Problem
One of the changes made in 2021 edition is that TryInto, TryFrom, and FromIterator are now in scope by default (link). So an explicit use statement is now redundant.
However, it seems like neither cargo fix --edition nor cargo fix --edition-idioms (and not even clippy!) catches this. I'm not sure which one of the these should be responsible, but it seems like one of them should at least emit a warning for this.
Steps
- Checkout a Rust project on 2018 edition that uses
TryInto,TryFrom, andFromIterator. An example would be bat before 4b33093. - Perform the normal edition upgrade procedure.
- Notice that the explicit
usestatements are not caught (no warnings).
Possible Solution(s)
Make cargo fix --edition or cargo fix --edition-idioms catch this and warn about it. Or maybe have clippy do this. Which one is more appropriate I'm not sure.
Notes
No response
Version
cargo 1.73.0 (9c4383fb5 2023-08-26)
release: 1.73.0
commit-hash: 9c4383fb55986096b414d98125421ab87b5fd642
commit-date: 2023-08-26
host: x86_64-unknown-linux-gnu
libgit2: 1.6.4 (sys:0.17.2 vendored)
libcurl: 8.2.1-DEV (sys:0.4.65+curl-8.2.1 vendored ssl:OpenSSL/1.1.1u)
ssl: OpenSSL 1.1.1u 30 May 2023
os: EndeavourOS Rolling Release (rolling) [64-bit]
Metadata
Metadata
Assignees
Labels
A-edition-2021Area: The 2021 editionArea: The 2021 editionA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.