Skip to content

Commit 7667aa6

Browse files
committed
Refactoring a bit
1 parent 519dc15 commit 7667aa6

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

Cargo.lock

Lines changed: 0 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ra_hir_def/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,11 @@ impl AsMacroCall for AstIdWithPath<ast::ModuleItem> {
476476
) -> Option<MacroCallId> {
477477
let def = resolver(self.path.clone())?;
478478
Some(
479-
def.as_lazy_macro(db.upcast(), MacroCallKind::Attr(self.ast_id, self.path.to_string()))
480-
.into(),
479+
def.as_lazy_macro(
480+
db.upcast(),
481+
MacroCallKind::Attr(self.ast_id, self.path.segments.last()?.to_string()),
482+
)
483+
.into(),
481484
)
482485
}
483486
}

crates/ra_hir_expand/src/builtin_derive.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ fn partial_ord_expand(
229229
mod tests {
230230
use super::*;
231231
use crate::{test_db::TestDB, AstId, MacroCallId, MacroCallKind, MacroCallLoc};
232-
use name::Name;
232+
use name::{known, Name};
233233
use ra_db::{fixture::WithFixture, SourceDatabase};
234234

235235
fn expand_builtin_derive(s: &str, name: Name) -> String {
@@ -261,7 +261,7 @@ mod tests {
261261
#[derive(Copy)]
262262
struct Foo;
263263
"#,
264-
name::known::Copy,
264+
known::Copy,
265265
);
266266

267267
assert_eq!(expanded, "impl< >std::marker::CopyforFoo< >{}");
@@ -274,7 +274,7 @@ mod tests {
274274
#[derive(Copy)]
275275
struct Foo<A, B>;
276276
"#,
277-
name::known::Copy,
277+
known::Copy,
278278
);
279279

280280
assert_eq!(
@@ -290,7 +290,7 @@ mod tests {
290290
#[derive(Copy)]
291291
struct Foo<A, B, 'a, 'b>;
292292
"#,
293-
name::known::Copy,
293+
known::Copy,
294294
);
295295

296296
// We currently just ignore lifetimes
@@ -308,7 +308,7 @@ mod tests {
308308
#[derive(Clone)]
309309
struct Foo<A, B>;
310310
"#,
311-
name::known::Clone,
311+
known::Clone,
312312
);
313313

314314
assert_eq!(

0 commit comments

Comments
 (0)