forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
269 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -556,6 +556,7 @@ declare_lint! { | |
/// fn main() { | ||
/// use foo::bar; | ||
/// foo::bar(); | ||
/// bar(); | ||
/// } | ||
/// ``` | ||
/// | ||
|
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
50 changes: 50 additions & 0 deletions
50
tests/ui/lint/unnecessary-qualification/lint-unnecessary-qualification-issue-121331.fixed
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,50 @@ | ||
//@ run-rustfix | ||
//@ edition:2021 | ||
#![deny(unused_qualifications)] | ||
#![deny(unused_imports)] | ||
#![feature(coroutines, coroutine_trait)] | ||
|
||
use std::ops::{ | ||
Coroutine, | ||
CoroutineState::{self}, | ||
//~^ ERROR unused import: `*` | ||
}; | ||
use std::pin::Pin; | ||
|
||
#[allow(dead_code)] | ||
fn finish<T>(mut amt: usize, mut t: T) -> T::Return | ||
where T: Coroutine<(), Yield = ()> + Unpin, | ||
{ | ||
loop { | ||
match Pin::new(&mut t).resume(()) { | ||
CoroutineState::Yielded(()) => amt = amt.checked_sub(1).unwrap(), | ||
CoroutineState::Complete(ret) => { | ||
assert_eq!(amt, 0); | ||
return ret | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
mod foo { | ||
pub fn bar() {} | ||
} | ||
|
||
pub fn main() { | ||
|
||
use foo::bar; | ||
bar(); | ||
//~^ ERROR unnecessary qualification | ||
bar(); | ||
|
||
// The item `use std::string::String` is imported redundantly. | ||
// Suppress `unused_imports` reporting, otherwise the fixed file will report an error | ||
#[allow(unused_imports)] | ||
use std::string::String; | ||
let s = String::new(); | ||
let y = std::string::String::new(); | ||
// unnecessary qualification | ||
println!("{} {}", s, y); | ||
|
||
} |
Oops, something went wrong.