diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-10-30 17:39:18 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-10-30 17:39:18 +0000 |
commit | eee55d4663084a01ce80f5ee201d8e1e345417cd (patch) | |
tree | 7fc1497065d00cfba1cd00523ed9545886745da1 /crates/ra_ide_api/src | |
parent | d929f9c49bceb3b7c32ea45c5e55c42f168bbf34 (diff) | |
parent | b441b4e8effeaf4532fd2e45c4d864480857c49e (diff) |
Merge #2129
2129: Some clippy fixes r=kjeremy a=kjeremy
Co-authored-by: kjeremy <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r-- | crates/ra_ide_api/src/call_info.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/change.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_path.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/presentation.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide_api/src/references/search_scope.rs | 5 | ||||
-rw-r--r-- | crates/ra_ide_api/src/typing.rs | 2 |
6 files changed, 8 insertions, 9 deletions
diff --git a/crates/ra_ide_api/src/call_info.rs b/crates/ra_ide_api/src/call_info.rs index 175af3fd9..e494f5620 100644 --- a/crates/ra_ide_api/src/call_info.rs +++ b/crates/ra_ide_api/src/call_info.rs | |||
@@ -95,7 +95,7 @@ impl FnCallNode { | |||
95 | Some(FnCallNode::CallExpr(expr)) | 95 | Some(FnCallNode::CallExpr(expr)) |
96 | } else if let Some(expr) = ast::MethodCallExpr::cast(node.clone()) { | 96 | } else if let Some(expr) = ast::MethodCallExpr::cast(node.clone()) { |
97 | Some(FnCallNode::MethodCallExpr(expr)) | 97 | Some(FnCallNode::MethodCallExpr(expr)) |
98 | } else if let Some(expr) = ast::MacroCall::cast(node.clone()) { | 98 | } else if let Some(expr) = ast::MacroCall::cast(node) { |
99 | Some(FnCallNode::MacroCallExpr(expr)) | 99 | Some(FnCallNode::MacroCallExpr(expr)) |
100 | } else { | 100 | } else { |
101 | None | 101 | None |
diff --git a/crates/ra_ide_api/src/change.rs b/crates/ra_ide_api/src/change.rs index 050249c0e..39c5946c7 100644 --- a/crates/ra_ide_api/src/change.rs +++ b/crates/ra_ide_api/src/change.rs | |||
@@ -43,7 +43,7 @@ impl fmt::Debug for AnalysisChange { | |||
43 | if !self.libraries_added.is_empty() { | 43 | if !self.libraries_added.is_empty() { |
44 | d.field("libraries_added", &self.libraries_added.len()); | 44 | d.field("libraries_added", &self.libraries_added.len()); |
45 | } | 45 | } |
46 | if !self.crate_graph.is_some() { | 46 | if !self.crate_graph.is_none() { |
47 | d.field("crate_graph", &self.crate_graph); | 47 | d.field("crate_graph", &self.crate_graph); |
48 | } | 48 | } |
49 | d.finish() | 49 | d.finish() |
diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index 956d8ce49..a58fdc036 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs | |||
@@ -67,7 +67,7 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) { | |||
67 | }); | 67 | }); |
68 | } | 68 | } |
69 | } | 69 | } |
70 | _ => return, | 70 | _ => {} |
71 | }; | 71 | }; |
72 | } | 72 | } |
73 | 73 | ||
diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs index f7e98e6df..65bb639ed 100644 --- a/crates/ra_ide_api/src/completion/presentation.rs +++ b/crates/ra_ide_api/src/completion/presentation.rs | |||
@@ -136,7 +136,7 @@ impl Completions { | |||
136 | for (idx, s) in docs.match_indices(¯o_name) { | 136 | for (idx, s) in docs.match_indices(¯o_name) { |
137 | let (before, after) = (&docs[..idx], &docs[idx + s.len()..]); | 137 | let (before, after) = (&docs[..idx], &docs[idx + s.len()..]); |
138 | // Ensure to match the full word | 138 | // Ensure to match the full word |
139 | if after.starts_with("!") | 139 | if after.starts_with('!') |
140 | && before | 140 | && before |
141 | .chars() | 141 | .chars() |
142 | .rev() | 142 | .rev() |
@@ -225,7 +225,7 @@ impl Completions { | |||
225 | } else { | 225 | } else { |
226 | (format!("{}($0)", data.name()), format!("{}(…)", name)) | 226 | (format!("{}($0)", data.name()), format!("{}(…)", name)) |
227 | }; | 227 | }; |
228 | builder = builder.lookup_by(name.clone()).label(label).insert_snippet(snippet); | 228 | builder = builder.lookup_by(name).label(label).insert_snippet(snippet); |
229 | } | 229 | } |
230 | 230 | ||
231 | self.add(builder) | 231 | self.add(builder) |
diff --git a/crates/ra_ide_api/src/references/search_scope.rs b/crates/ra_ide_api/src/references/search_scope.rs index dbd1af597..f2789e0b2 100644 --- a/crates/ra_ide_api/src/references/search_scope.rs +++ b/crates/ra_ide_api/src/references/search_scope.rs | |||
@@ -111,8 +111,7 @@ impl NameDefinition { | |||
111 | if vis.as_str() != "" { | 111 | if vis.as_str() != "" { |
112 | let source_root_id = db.file_source_root(file_id); | 112 | let source_root_id = db.file_source_root(file_id); |
113 | let source_root = db.source_root(source_root_id); | 113 | let source_root = db.source_root(source_root_id); |
114 | let mut res = | 114 | let mut res = source_root.walk().map(|id| (id, None)).collect::<FxHashMap<_, _>>(); |
115 | source_root.walk().map(|id| (id.into(), None)).collect::<FxHashMap<_, _>>(); | ||
116 | 115 | ||
117 | // FIXME: add "pub(in path)" | 116 | // FIXME: add "pub(in path)" |
118 | 117 | ||
@@ -128,7 +127,7 @@ impl NameDefinition { | |||
128 | let root_file = crate_graph.crate_root(crate_id); | 127 | let root_file = crate_graph.crate_root(crate_id); |
129 | let source_root_id = db.file_source_root(root_file); | 128 | let source_root_id = db.file_source_root(root_file); |
130 | let source_root = db.source_root(source_root_id); | 129 | let source_root = db.source_root(source_root_id); |
131 | res.extend(source_root.walk().map(|id| (id.into(), None))); | 130 | res.extend(source_root.walk().map(|id| (id, None))); |
132 | } | 131 | } |
133 | } | 132 | } |
134 | return SearchScope::new(res); | 133 | return SearchScope::new(res); |
diff --git a/crates/ra_ide_api/src/typing.rs b/crates/ra_ide_api/src/typing.rs index 2dfbe6944..d51132f73 100644 --- a/crates/ra_ide_api/src/typing.rs +++ b/crates/ra_ide_api/src/typing.rs | |||
@@ -261,7 +261,7 @@ impl S { | |||
261 | 261 | ||
262 | fn type_char(char_typed: char, before: &str, after: &str) { | 262 | fn type_char(char_typed: char, before: &str, after: &str) { |
263 | let (actual, file_change) = do_type_char(char_typed, before) | 263 | let (actual, file_change) = do_type_char(char_typed, before) |
264 | .expect(&format!("typing `{}` did nothing", char_typed)); | 264 | .unwrap_or_else(|| panic!("typing `{}` did nothing", char_typed)); |
265 | 265 | ||
266 | if after.contains("<|>") { | 266 | if after.contains("<|>") { |
267 | let (offset, after) = extract_offset(after); | 267 | let (offset, after) = extract_offset(after); |