mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Remove redundant clone()
This commit is contained in:
parent
7e0fa71532
commit
9c45a9e586
14 changed files with 21 additions and 29 deletions
|
@ -137,7 +137,7 @@ impl ModuleSource {
|
|||
match &find_node_at_offset::<ast::Module>(parse.tree().syntax(), position.offset) {
|
||||
Some(m) if !m.has_semi() => ModuleSource::Module(m.clone()),
|
||||
_ => {
|
||||
let source_file = parse.tree().to_owned();
|
||||
let source_file = parse.tree();
|
||||
ModuleSource::SourceFile(source_file)
|
||||
}
|
||||
}
|
||||
|
@ -149,15 +149,15 @@ impl ModuleSource {
|
|||
child: &SyntaxNode,
|
||||
) -> ModuleSource {
|
||||
if let Some(m) = child.ancestors().filter_map(ast::Module::cast).find(|it| !it.has_semi()) {
|
||||
ModuleSource::Module(m.clone())
|
||||
ModuleSource::Module(m)
|
||||
} else {
|
||||
let source_file = db.parse(file_id).tree().to_owned();
|
||||
let source_file = db.parse(file_id).tree();
|
||||
ModuleSource::SourceFile(source_file)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_file_id(db: &(impl DefDatabase + AstDatabase), file_id: FileId) -> ModuleSource {
|
||||
let source_file = db.parse(file_id).tree().to_owned();
|
||||
let source_file = db.parse(file_id).tree();
|
||||
ModuleSource::SourceFile(source_file)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue