mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 07:04:18 +00:00
Add test and update reference.
This commit is contained in:
parent
512efbea23
commit
26b1d60f15
3 changed files with 34 additions and 0 deletions
12
tests/ui/single_component_path_imports.fixed
Normal file
12
tests/ui/single_component_path_imports.fixed
Normal file
|
@ -0,0 +1,12 @@
|
|||
// run-rustfix
|
||||
// compile-flags: --edition 2018
|
||||
#![warn(clippy::single_component_path_imports)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
|
||||
use serde as edres;
|
||||
pub use serde;
|
||||
|
||||
fn main() {
|
||||
regex::Regex::new(r"^\d{4}-\d{2}-\d{2}$").unwrap();
|
||||
}
|
12
tests/ui/single_component_path_imports.rs
Normal file
12
tests/ui/single_component_path_imports.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
// run-rustfix
|
||||
// compile-flags: --edition 2018
|
||||
#![warn(clippy::single_component_path_imports)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use regex;
|
||||
use serde as edres;
|
||||
pub use serde;
|
||||
|
||||
fn main() {
|
||||
regex::Regex::new(r"^\d{4}-\d{2}-\d{2}$").unwrap();
|
||||
}
|
10
tests/ui/single_component_path_imports.stderr
Normal file
10
tests/ui/single_component_path_imports.stderr
Normal file
|
@ -0,0 +1,10 @@
|
|||
error: this import is redundant
|
||||
--> $DIR/single_component_path_imports.rs:6:1
|
||||
|
|
||||
LL | use regex;
|
||||
| ^^^^^^^^^^ help: remove it entirely
|
||||
|
|
||||
= note: `-D clippy::single-component-path-imports` implied by `-D warnings`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
Reference in a new issue