From 1b8a26653f9d8734767a40af576223e267d51d6d Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Fri, 27 Mar 2020 12:15:38 +0800 Subject: Use matches in is_dylib --- crates/ra_project_model/src/cargo_workspace.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'crates/ra_project_model/src') 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) // FIXME: File a better way to know if it is a dylib fn is_dylib(path: &Path) -> bool { - let ext = match path.extension().and_then(OsStr::to_str).map(|it| it.to_string().to_lowercase()) - { - None => return false, - Some(ext) => ext, - }; - - match ext.as_str() { - "dll" => true, - "dylib" => true, - "so" => true, - _ => false, + match path.extension().and_then(OsStr::to_str).map(|it| it.to_string().to_lowercase()) { + None => false, + Some(ext) => matches!(ext.as_str(), "dll" | "dylib" | "so"), } } -- cgit v1.2.3