Skip to content

Commit c2436d9

Browse files
committed
stronger test
1 parent d45be57 commit c2436d9

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

clippy_lints/src/use_crate_prefix_for_self_imports.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,10 @@ impl<'tcx> UseCratePrefixForSelfImports<'_, 'tcx> {
9898
if self.use_block.iter().any(|x| x.span.contains(item.span)) {
9999
return true;
100100
}
101-
if let Some(prev_item) = self.use_block.last()
102-
&& item.span.lo() - prev_item.span.hi() == BytePos(1)
101+
if self
102+
.use_block
103+
.iter()
104+
.any(|x| item.span.lo() - x.span.hi() == BytePos(1))
103105
{
104106
return true;
105107
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[package]
2+
name = "pass_sibling_4"
3+
version = "0.1.0"
4+
edition = "2021"
5+
publish = false
6+
7+
[dependencies]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pub struct Foo;
2+
pub struct Bar;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pub use foo::{Bar, Foo};
2+
mod foo;
3+
4+
fn main() {
5+
let _foo = Foo;
6+
let _bar = Bar;
7+
}

0 commit comments

Comments
 (0)