diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-21 06:12:36 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-21 06:12:36 +0000 |
commit | 1cbef27ff857803fbee123e6730b83e1ef154f6c (patch) | |
tree | 7d45ce377fb8f4c7019bb74381228b94f397110f /crates/ra_lsp_server/src | |
parent | 6eab968c601637361e8fbd1ee93ded1b0d967bee (diff) | |
parent | 0d5d63a80ea08f2af439bcc72fff9b24d144c70d (diff) |
Merge #2625
2625: Clippy lints r=matklad a=kjeremy
Co-authored-by: kjeremy <[email protected]>
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop.rs | 2 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 2 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/world.rs | 20 |
3 files changed, 10 insertions, 14 deletions
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs index 965e7c53c..9e207415e 100644 --- a/crates/ra_lsp_server/src/main_loop.rs +++ b/crates/ra_lsp_server/src/main_loop.rs | |||
@@ -131,7 +131,7 @@ pub fn main_loop( | |||
131 | let feature_flags = { | 131 | let feature_flags = { |
132 | let mut ff = FeatureFlags::default(); | 132 | let mut ff = FeatureFlags::default(); |
133 | for (flag, value) in config.feature_flags { | 133 | for (flag, value) in config.feature_flags { |
134 | if let Err(_) = ff.set(flag.as_str(), value) { | 134 | if ff.set(flag.as_str(), value).is_err() { |
135 | log::error!("unknown feature flag: {:?}", flag); | 135 | log::error!("unknown feature flag: {:?}", flag); |
136 | show_message( | 136 | show_message( |
137 | req::MessageType::Error, | 137 | req::MessageType::Error, |
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 5b64b27cd..5e3b1a73f 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs | |||
@@ -164,7 +164,7 @@ pub fn handle_on_type_formatting( | |||
164 | 164 | ||
165 | // in `ra_ide`, the `on_type` invariant is that | 165 | // in `ra_ide`, the `on_type` invariant is that |
166 | // `text.char_at(position) == typed_char`. | 166 | // `text.char_at(position) == typed_char`. |
167 | position.offset = position.offset - TextUnit::of_char('.'); | 167 | position.offset -= TextUnit::of_char('.'); |
168 | let char_typed = params.ch.chars().next().unwrap_or('\0'); | 168 | let char_typed = params.ch.chars().next().unwrap_or('\0'); |
169 | 169 | ||
170 | // We have an assist that inserts ` ` after typing `->` in `fn foo() ->{`, | 170 | // We have an assist that inserts ` ` after typing `->` in `fn foo() ->{`, |
diff --git a/crates/ra_lsp_server/src/world.rs b/crates/ra_lsp_server/src/world.rs index 16cc11e8c..f89b23089 100644 --- a/crates/ra_lsp_server/src/world.rs +++ b/crates/ra_lsp_server/src/world.rs | |||
@@ -287,19 +287,15 @@ impl WorldSnapshot { | |||
287 | /// | 287 | /// |
288 | /// When processing non-windows path, this is essentially the same as `Url::from_file_path`. | 288 | /// When processing non-windows path, this is essentially the same as `Url::from_file_path`. |
289 | fn url_from_path_with_drive_lowercasing(path: impl AsRef<Path>) -> Result<Url> { | 289 | fn url_from_path_with_drive_lowercasing(path: impl AsRef<Path>) -> Result<Url> { |
290 | let component_has_windows_drive = path | 290 | let component_has_windows_drive = path.as_ref().components().any(|comp| { |
291 | .as_ref() | 291 | if let Component::Prefix(c) = comp { |
292 | .components() | 292 | match c.kind() { |
293 | .find(|comp| { | 293 | Prefix::Disk(_) | Prefix::VerbatimDisk(_) => return true, |
294 | if let Component::Prefix(c) = comp { | 294 | _ => return false, |
295 | match c.kind() { | ||
296 | Prefix::Disk(_) | Prefix::VerbatimDisk(_) => return true, | ||
297 | _ => return false, | ||
298 | } | ||
299 | } | 295 | } |
300 | false | 296 | } |
301 | }) | 297 | false |
302 | .is_some(); | 298 | }); |
303 | 299 | ||
304 | // VSCode expects drive letters to be lowercased, where rust will uppercase the drive letters. | 300 | // VSCode expects drive letters to be lowercased, where rust will uppercase the drive letters. |
305 | if component_has_windows_drive { | 301 | if component_has_windows_drive { |