ItemKind::Use(..) => {
// don't suggest placing a use before the prelude
// import or other generated ones
- if item.span == DUMMY_SP {
+ if item.span.ctxt().outer().expn_info().is_none() {
self.span = Some(item.span.with_hi(item.span.lo()));
self.found_use = true;
return;
ItemKind::ExternCrate(_) => {}
// but place them before the first other item
_ => if self.span.map_or(true, |span| item.span < span ) {
- self.span = Some(item.span.with_hi(item.span.lo()));
+ if item.span.ctxt().outer().expn_info().is_none() {
+ // don't insert between attributes and an item
+ if item.attrs.is_empty() {
+ self.span = Some(item.span.with_hi(item.span.lo()));
+ } else {
+ // find the first attribute on the item
+ for attr in &item.attrs {
+ if self.span.map_or(true, |span| attr.span < span) {
+ self.span = Some(attr.span.with_hi(attr.span.lo()));
+ }
+ }
+ }
+ }
},
}
}
|
help: possible better candidate is found in another module, you can import it into scope
|
-16 | use m::n::Z;
+22 | use m::n::Z;
|
error[E0423]: expected value, found struct `S`
|
help: possible better candidate is found in another module, you can import it into scope
|
-15 | use m::S;
+32 | use m::S;
|
error[E0423]: expected value, found struct `xcrate::S`
|
help: possible better candidate is found in another module, you can import it into scope
|
-15 | use m::S;
+32 | use m::S;
|
error[E0603]: tuple struct `Z` is private
|
help: possible candidate is found in another module, you can import it into scope
|
-20 | #[derive(use std::path::Path;
+21 | use std::path::Path;
|
error[E0425]: cannot find value `A` in this scope