diff options
| author | xiongmao86 <xiongmao86dev@sina.com> | 2020-01-30 00:22:42 +0800 |
|---|---|---|
| committer | xiongmao86 <xiongmao86dev@sina.com> | 2020-01-30 00:22:42 +0800 |
| commit | 26b1d60f1589b843840b989f16f348bca65b27f6 (patch) | |
| tree | 878493cfa49af2241928c4ea562af23ffc02c1b3 | |
| parent | 512efbea2321dafd19d30eacb9d8f9d21fcedae2 (diff) | |
| download | rust-26b1d60f1589b843840b989f16f348bca65b27f6.tar.gz rust-26b1d60f1589b843840b989f16f348bca65b27f6.zip | |
Add test and update reference.
| -rw-r--r-- | tests/ui/single_component_path_imports.fixed | 12 | ||||
| -rw-r--r-- | tests/ui/single_component_path_imports.rs | 12 | ||||
| -rw-r--r-- | tests/ui/single_component_path_imports.stderr | 10 |
3 files changed, 34 insertions, 0 deletions
diff --git a/tests/ui/single_component_path_imports.fixed b/tests/ui/single_component_path_imports.fixed new file mode 100644 index 00000000000..7a882efc4d1 --- /dev/null +++ b/tests/ui/single_component_path_imports.fixed @@ -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(); +} diff --git a/tests/ui/single_component_path_imports.rs b/tests/ui/single_component_path_imports.rs new file mode 100644 index 00000000000..d084425cd70 --- /dev/null +++ b/tests/ui/single_component_path_imports.rs @@ -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(); +} diff --git a/tests/ui/single_component_path_imports.stderr b/tests/ui/single_component_path_imports.stderr new file mode 100644 index 00000000000..519ada0169a --- /dev/null +++ b/tests/ui/single_component_path_imports.stderr @@ -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 + |
