-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #122165 - chenyukang:yukang-fix-121315-suggest-removing…
…, r=<try> Merge RedundantImport into UnusedImport for suggesting removing spans Fixes #121315 I also changed the label of diagnostics for RedundantImport to be compatible with UnusedImport, or any other better ways? r? `@petrochenkov`
- Loading branch information
Showing
25 changed files
with
245 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//@ run-rustfix | ||
//@ compile-flags: --edition 2021 | ||
#![deny(unused_imports)] | ||
#![allow(dead_code)] | ||
|
||
fn test0() { | ||
// Test remove FlatUnused | ||
|
||
//~^ ERROR redundant import | ||
let _ = u32::try_from(5i32); | ||
} | ||
|
||
fn test1() { | ||
// Test remove NestedFullUnused | ||
|
||
//~^ ERROR redundant imports | ||
|
||
let _ = u32::try_from(5i32); | ||
let _a: i32 = u32::try_into(5u32).unwrap(); | ||
} | ||
|
||
fn test2() { | ||
// Test remove both redundant and unused | ||
|
||
//~^ ERROR unused or redundant imports: `AsMut`, `Into` | ||
|
||
let _a: u32 = (5u8).into(); | ||
} | ||
|
||
fn test3() { | ||
// Test remove NestedPartialUnused | ||
use std::convert::{Infallible}; | ||
//~^ ERROR unused import: `From` | ||
|
||
trait MyTrait {} | ||
impl MyTrait for fn() -> Infallible {} | ||
} | ||
|
||
fn main() {} |
Oops, something went wrong.