aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/from_source.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-09-25 06:27:07 +0100
committerGitHub <[email protected]>2019-09-25 06:27:07 +0100
commit6bac2d0a637a6d0b3922a6f8fe05fa32d6d43b15 (patch)
treec3c2af75fa7be376506bf0ffe23fe8cad9c6c402 /crates/ra_hir/src/from_source.rs
parentc7420ddaaa76741d1eebe393406b38ba5596e54a (diff)
parent9c45a9e58632966984a79e18aa5221efb65e0ead (diff)
Merge #1904
1904: Remove redundant `clone()` r=matklad a=sinkuu Co-authored-by: Shotaro Yamada <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/from_source.rs')
-rw-r--r--crates/ra_hir/src/from_source.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs
index f3194595f..7b6d9b240 100644
--- a/crates/ra_hir/src/from_source.rs
+++ b/crates/ra_hir/src/from_source.rs
@@ -137,7 +137,7 @@ impl ModuleSource {
137 match &find_node_at_offset::<ast::Module>(parse.tree().syntax(), position.offset) { 137 match &find_node_at_offset::<ast::Module>(parse.tree().syntax(), position.offset) {
138 Some(m) if !m.has_semi() => ModuleSource::Module(m.clone()), 138 Some(m) if !m.has_semi() => ModuleSource::Module(m.clone()),
139 _ => { 139 _ => {
140 let source_file = parse.tree().to_owned(); 140 let source_file = parse.tree();
141 ModuleSource::SourceFile(source_file) 141 ModuleSource::SourceFile(source_file)
142 } 142 }
143 } 143 }
@@ -149,15 +149,15 @@ impl ModuleSource {
149 child: &SyntaxNode, 149 child: &SyntaxNode,
150 ) -> ModuleSource { 150 ) -> ModuleSource {
151 if let Some(m) = child.ancestors().filter_map(ast::Module::cast).find(|it| !it.has_semi()) { 151 if let Some(m) = child.ancestors().filter_map(ast::Module::cast).find(|it| !it.has_semi()) {
152 ModuleSource::Module(m.clone()) 152 ModuleSource::Module(m)
153 } else { 153 } else {
154 let source_file = db.parse(file_id).tree().to_owned(); 154 let source_file = db.parse(file_id).tree();
155 ModuleSource::SourceFile(source_file) 155 ModuleSource::SourceFile(source_file)
156 } 156 }
157 } 157 }
158 158
159 pub fn from_file_id(db: &(impl DefDatabase + AstDatabase), file_id: FileId) -> ModuleSource { 159 pub fn from_file_id(db: &(impl DefDatabase + AstDatabase), file_id: FileId) -> ModuleSource {
160 let source_file = db.parse(file_id).tree().to_owned(); 160 let source_file = db.parse(file_id).tree();
161 ModuleSource::SourceFile(source_file) 161 ModuleSource::SourceFile(source_file)
162 } 162 }
163} 163}