diff options
author | Edwin Cheng <[email protected]> | 2020-03-27 04:15:38 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2020-03-31 15:20:18 +0100 |
commit | 1b8a26653f9d8734767a40af576223e267d51d6d (patch) | |
tree | 1d64ba463172f635ac4d10abcc909f93255e49fa /crates | |
parent | 3b9722092622c8652d2028f3cf67e7ce2f7c935a (diff) |
Use matches in is_dylib
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_project_model/src/cargo_workspace.rs | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index 32592e660..0aea01d83 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs | |||
@@ -323,16 +323,8 @@ pub fn load_extern_resources(cargo_toml: &Path, cargo_features: &CargoFeatures) | |||
323 | 323 | ||
324 | // FIXME: File a better way to know if it is a dylib | 324 | // FIXME: File a better way to know if it is a dylib |
325 | fn is_dylib(path: &Path) -> bool { | 325 | fn is_dylib(path: &Path) -> bool { |
326 | let ext = match path.extension().and_then(OsStr::to_str).map(|it| it.to_string().to_lowercase()) | 326 | match path.extension().and_then(OsStr::to_str).map(|it| it.to_string().to_lowercase()) { |
327 | { | 327 | None => false, |
328 | None => return false, | 328 | Some(ext) => matches!(ext.as_str(), "dll" | "dylib" | "so"), |
329 | Some(ext) => ext, | ||
330 | }; | ||
331 | |||
332 | match ext.as_str() { | ||
333 | "dll" => true, | ||
334 | "dylib" => true, | ||
335 | "so" => true, | ||
336 | _ => false, | ||
337 | } | 329 | } |
338 | } | 330 | } |