aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src
diff options
context:
space:
mode:
authorAlan Du <[email protected]>2019-06-03 15:27:51 +0100
committerAlan Du <[email protected]>2019-06-04 23:05:07 +0100
commitb28ca32db22d5e2ed34db556c6fd50a5fc2d679c (patch)
tree7e86e3f6ffdbc972b2ac968503f2b3671fd9b3a5 /crates/ra_assists/src
parent40424d4222d4630bc53294d10f1718f2d3d300de (diff)
Fix clippy::or_fun_call
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r--crates/ra_assists/src/auto_import.rs4
-rw-r--r--crates/ra_assists/src/change_visibility.rs2
2 files changed, 3 insertions, 3 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 }
diff --git a/crates/ra_assists/src/change_visibility.rs b/crates/ra_assists/src/change_visibility.rs
index 620f534b5..4eb24d27f 100644
--- a/crates/ra_assists/src/change_visibility.rs
+++ b/crates/ra_assists/src/change_visibility.rs
@@ -59,7 +59,7 @@ fn vis_offset(node: &SyntaxNode) -> TextUnit {
59 }) 59 })
60 .next() 60 .next()
61 .map(|it| it.range().start()) 61 .map(|it| it.range().start())
62 .unwrap_or(node.range().start()) 62 .unwrap_or_else(|| node.range().start())
63} 63}
64 64
65fn change_vis(mut ctx: AssistCtx<impl HirDatabase>, vis: &ast::Visibility) -> Option<Assist> { 65fn change_vis(mut ctx: AssistCtx<impl HirDatabase>, vis: &ast::Visibility) -> Option<Assist> {