Skip to content

Commit 8be660a

Browse files
committed
Multiline working
1 parent 5f51606 commit 8be660a

File tree

2 files changed

+46
-12
lines changed

2 files changed

+46
-12
lines changed

clippy_lints/src/std_instead_of_core.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ impl StdReexports {
152152
self.open_use = Some(collected_use);
153153
return;
154154
}
155+
if collected_use.members.is_empty() {
156+
return;
157+
}
155158
let mut place_holder_unique_check: Option<(Span, ReplaceLintData)> = None;
156159
let mut can_chunk = true;
157160
for member in collected_use.members.iter() {
@@ -384,11 +387,6 @@ impl<'tcx> LateLintPass<'tcx> for StdReexports {
384387
fn check_variant(&mut self, cx: &LateContext<'tcx>, v: &'tcx Variant<'tcx>) {
385388
self.suggest_for_open_use_item_if_after(cx, v.span);
386389
}
387-
388-
#[inline]
389-
fn check_attribute(&mut self, cx: &LateContext<'tcx>, attr: &'tcx Attribute) {
390-
self.suggest_for_open_use_item_if_after(cx, attr.span);
391-
}
392390
}
393391

394392
/// Returns the first named segment of a [`Path`].

tests/ui/std_instead_of_core.stderr

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,52 @@ LL | use std::{fmt::Debug as _, fmt::Alignment as _, io::Write as _};
7474
= help: consider importing the item from `core`
7575

7676
error: used import from `std` instead of `core`
77-
--> tests/ui/std_instead_of_core.rs:57:9
77+
--> tests/ui/std_instead_of_core.rs:51:9
7878
|
79-
LL | use std::{
80-
| ^^^ help: consider importing the item from `core`: `core`
79+
LL | fmt::Debug as _,
80+
| ^^^^^^^^^^
81+
|
82+
= help: consider importing the item from `core`
8183

8284
error: used import from `std` instead of `core`
83-
--> tests/ui/std_instead_of_core.rs:65:9
85+
--> tests/ui/std_instead_of_core.rs:52:9
8486
|
85-
LL | use std::{
86-
| ^^^ help: consider importing the item from `core`: `core`
87+
LL | fmt::Alignment as _,
88+
| ^^^^^^^^^^^^^^
89+
|
90+
= help: consider importing the item from `core`
91+
92+
error: used import from `std` instead of `core`
93+
--> tests/ui/std_instead_of_core.rs:58:9
94+
|
95+
LL | fmt::Alignment as _,
96+
| ^^^^^^^^^^^^^^
97+
|
98+
= help: consider importing the item from `core`
99+
100+
error: used import from `std` instead of `core`
101+
--> tests/ui/std_instead_of_core.rs:60:9
102+
|
103+
LL | fmt::Debug as _,
104+
| ^^^^^^^^^^
105+
|
106+
= help: consider importing the item from `core`
107+
108+
error: used import from `std` instead of `core`
109+
--> tests/ui/std_instead_of_core.rs:66:9
110+
|
111+
LL | fmt::Alignment as _,
112+
| ^^^^^^^^^^^^^^
113+
|
114+
= help: consider importing the item from `core`
115+
116+
error: used import from `std` instead of `core`
117+
--> tests/ui/std_instead_of_core.rs:67:9
118+
|
119+
LL | fmt::Debug as _,
120+
| ^^^^^^^^^^
121+
|
122+
= help: consider importing the item from `core`
87123

88124
error: used import from `std` instead of `core`
89125
--> tests/ui/std_instead_of_core.rs:72:15
@@ -139,5 +175,5 @@ LL | use alloc::slice::from_ref;
139175
= note: `-D clippy::alloc-instead-of-core` implied by `-D warnings`
140176
= help: to override `-D warnings` add `#[allow(clippy::alloc_instead_of_core)]`
141177

142-
error: aborting due to 20 previous errors
178+
error: aborting due to 24 previous errors
143179

0 commit comments

Comments
 (0)