mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
30642113b2
Dedup std_instead_of_core by using first segment span for uniqueness Relates to #12379. Instead of checking that the paths have an identical span, it checks that the relevant `std` part of the path segment's span is identical. Added a multiline test, because my first implementation was worse and failed that, then I realized that you could grab the span off the first_segment `Ident`. I did find another bug that isn't addressed by this, and that exists on master as well. The path: ```Rust use std::{io::Write, fmt::Display}; ``` Will get fixed into: ```Rust use core::{io::Write, fmt::Display}; ``` Which doesn't compile since `io::Write` isn't in `core`, if any of those paths are present in `core` it'll do the replace and cause a miscompilation. Do you think I should file a separate bug for that? Since `rustfmt` default splits those up it isn't that big of a deal. Rustfmt: ```Rust // Pre use std::{io::Write, fmt::Display}; // Post use std::fmt::Display; use std::io::Write; ``` --- changelog: [`std_instead_of_core`]: Fix duplicated output on multiple imports |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |