aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/auto_import.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-06-04 23:14:46 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-06-04 23:14:46 +0100
commit5deb907b4321d8328978d3322b0826b781814452 (patch)
tree2baa3b75b1ef62c02617c37ba9b800c41a3dd102 /crates/ra_assists/src/auto_import.rs
parent8bd0e844247dc28d6ceb24b00f3cc3396bd5bf03 (diff)
parentaa30c4909ebb1e85f1591f465c9e2875aa4d394e (diff)
Merge #1374
1374: Implement `cargo lint` and fix some clippy errors r=alanhdu a=alanhdu This creates a `cargo lint` command that runs clippy with certain lints disabled. I've also gone ahead and fixed some of the lint errors, although there are many more still to go. cc #848 Co-authored-by: Alan Du <[email protected]>
Diffstat (limited to 'crates/ra_assists/src/auto_import.rs')
-rw-r--r--crates/ra_assists/src/auto_import.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_assists/src/auto_import.rs b/crates/ra_assists/src/auto_import.rs
index 1566cf179..9617beb5c 100644
--- a/crates/ra_assists/src/auto_import.rs
+++ b/crates/ra_assists/src/auto_import.rs
@@ -334,7 +334,7 @@ fn best_action_for_target<'b, 'a: 'b>(
334 .filter_map(ast::UseItem::use_tree) 334 .filter_map(ast::UseItem::use_tree)
335 .map(|u| walk_use_tree_for_best_action(&mut storage, None, u, target)) 335 .map(|u| walk_use_tree_for_best_action(&mut storage, None, u, target))
336 .fold(None, |best, a| { 336 .fold(None, |best, a| {
337 best.and_then(|best| Some(*ImportAction::better(&best, &a))).or(Some(a)) 337 best.and_then(|best| Some(*ImportAction::better(&best, &a))).or_else(|| Some(a))
338 }); 338 });
339 339
340 match best_action { 340 match best_action {
@@ -347,7 +347,7 @@ fn best_action_for_target<'b, 'a: 'b>(
347 let anchor = container 347 let anchor = container
348 .children() 348 .children()
349 .find(|n| n.range().start() < anchor.range().start()) 349 .find(|n| n.range().start() < anchor.range().start())
350 .or(Some(anchor)); 350 .or_else(|| Some(anchor));
351 351
352 return ImportAction::add_new_use(anchor, false); 352 return ImportAction::add_new_use(anchor, false);
353 } 353 }