mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Refactoring a bit
This commit is contained in:
parent
519dc15cb1
commit
7667aa6033
3 changed files with 10 additions and 15 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -1081,14 +1081,6 @@ dependencies = [
|
||||||
"drop_bomb",
|
"drop_bomb",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ra_proc_macro"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"ra_mbe",
|
|
||||||
"ra_tt",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ra_prof"
|
name = "ra_prof"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
|
@ -476,8 +476,11 @@ impl AsMacroCall for AstIdWithPath<ast::ModuleItem> {
|
||||||
) -> Option<MacroCallId> {
|
) -> Option<MacroCallId> {
|
||||||
let def = resolver(self.path.clone())?;
|
let def = resolver(self.path.clone())?;
|
||||||
Some(
|
Some(
|
||||||
def.as_lazy_macro(db.upcast(), MacroCallKind::Attr(self.ast_id, self.path.to_string()))
|
def.as_lazy_macro(
|
||||||
.into(),
|
db.upcast(),
|
||||||
|
MacroCallKind::Attr(self.ast_id, self.path.segments.last()?.to_string()),
|
||||||
|
)
|
||||||
|
.into(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,7 +229,7 @@ fn partial_ord_expand(
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{test_db::TestDB, AstId, MacroCallId, MacroCallKind, MacroCallLoc};
|
use crate::{test_db::TestDB, AstId, MacroCallId, MacroCallKind, MacroCallLoc};
|
||||||
use name::Name;
|
use name::{known, Name};
|
||||||
use ra_db::{fixture::WithFixture, SourceDatabase};
|
use ra_db::{fixture::WithFixture, SourceDatabase};
|
||||||
|
|
||||||
fn expand_builtin_derive(s: &str, name: Name) -> String {
|
fn expand_builtin_derive(s: &str, name: Name) -> String {
|
||||||
|
@ -261,7 +261,7 @@ mod tests {
|
||||||
#[derive(Copy)]
|
#[derive(Copy)]
|
||||||
struct Foo;
|
struct Foo;
|
||||||
"#,
|
"#,
|
||||||
name::known::Copy,
|
known::Copy,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(expanded, "impl< >std::marker::CopyforFoo< >{}");
|
assert_eq!(expanded, "impl< >std::marker::CopyforFoo< >{}");
|
||||||
|
@ -274,7 +274,7 @@ mod tests {
|
||||||
#[derive(Copy)]
|
#[derive(Copy)]
|
||||||
struct Foo<A, B>;
|
struct Foo<A, B>;
|
||||||
"#,
|
"#,
|
||||||
name::known::Copy,
|
known::Copy,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -290,7 +290,7 @@ mod tests {
|
||||||
#[derive(Copy)]
|
#[derive(Copy)]
|
||||||
struct Foo<A, B, 'a, 'b>;
|
struct Foo<A, B, 'a, 'b>;
|
||||||
"#,
|
"#,
|
||||||
name::known::Copy,
|
known::Copy,
|
||||||
);
|
);
|
||||||
|
|
||||||
// We currently just ignore lifetimes
|
// We currently just ignore lifetimes
|
||||||
|
@ -308,7 +308,7 @@ mod tests {
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
struct Foo<A, B>;
|
struct Foo<A, B>;
|
||||||
"#,
|
"#,
|
||||||
name::known::Clone,
|
known::Clone,
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue