style: clippy

This commit is contained in:
LongYinan 2022-06-10 15:20:06 +08:00
parent f90d63ccde
commit 18dc3df5ba
No known key found for this signature in database
GPG key ID: C3666B7FC82ADAD7
3 changed files with 3 additions and 7 deletions

View file

@ -40,11 +40,7 @@ pub struct NapiFnArg {
impl NapiFnArg { impl NapiFnArg {
/// if type was overridden with `#[napi(ts_arg_type = "...")]` use that instead /// if type was overridden with `#[napi(ts_arg_type = "...")]` use that instead
pub fn use_overridden_type_or(&self, default: impl FnOnce() -> String) -> String { pub fn use_overridden_type_or(&self, default: impl FnOnce() -> String) -> String {
self self.ts_arg_type.as_ref().cloned().unwrap_or_else(default)
.ts_arg_type
.as_ref()
.map(|ts| ts.clone())
.unwrap_or_else(default)
} }
} }

View file

@ -9,7 +9,7 @@ pub fn setup() -> Result<(), Error> {
let mut dist = path::PathBuf::from(&out_dir); let mut dist = path::PathBuf::from(&out_dir);
dist.push("libgcc.a"); dist.push("libgcc.a");
let mut libgcc = fs::File::create(&dist)?; let mut libgcc = fs::File::create(&dist)?;
libgcc.write(b"INPUT(-lunwind)")?; let _ = libgcc.write(b"INPUT(-lunwind)")?;
drop(libgcc); drop(libgcc);
println!("cargo:rustc-link-search={}", &out_dir); println!("cargo:rustc-link-search={}", &out_dir);
Ok(()) Ok(())

View file

@ -7,7 +7,7 @@ pub fn setup() {
Ok("macos") => { Ok("macos") => {
macos::setup(); macos::setup();
} }
Ok("android") => if let Ok(_) = android::setup() {}, Ok("android") => if android::setup().is_ok() {},
_ => {} _ => {}
} }
} }