style: clippy fix

This commit is contained in:
LongYinan 2021-12-02 16:31:57 +08:00
parent b2fea4d5b3
commit 77e4241b18
No known key found for this signature in database
GPG key ID: C3666B7FC82ADAD7
3 changed files with 3 additions and 3 deletions

View file

@ -245,7 +245,7 @@ impl NapiStruct {
}) = &ty }) = &ty
{ {
if let Some(last_path) = segments.last() { if let Some(last_path) = segments.last() {
last_path.ident.to_string() == "Option" last_path.ident == "Option"
} else { } else {
false false
} }

View file

@ -264,7 +264,7 @@ pub fn ty_to_ts_type(ty: &Type, is_return_ty: bool) -> (String, bool) {
.get(rust_ty.as_str()) .get(rust_ty.as_str())
.map(|a| (a.to_owned(), false)) .map(|a| (a.to_owned(), false))
}); });
ts_ty = type_alias.or_else(|| Some((rust_ty, false))); ts_ty = type_alias.or(Some((rust_ty, false)));
} }
} }

View file

@ -36,7 +36,7 @@ struct AllOptionalObject {
#[napi] #[napi]
fn receive_all_optional_object(obj: Option<AllOptionalObject>) -> Result<()> { fn receive_all_optional_object(obj: Option<AllOptionalObject>) -> Result<()> {
if !obj.is_none() { if obj.is_some() {
assert!(obj.as_ref().unwrap().name.is_none()); assert!(obj.as_ref().unwrap().name.is_none());
assert!(obj.as_ref().unwrap().age.is_none()); assert!(obj.as_ref().unwrap().age.is_none());
} }