diff --git a/rust/candid/src/pretty/candid.rs b/rust/candid/src/pretty/candid.rs index ebc4e624..d9b9b1b2 100644 --- a/rust/candid/src/pretty/candid.rs +++ b/rust/candid/src/pretty/candid.rs @@ -188,7 +188,7 @@ fn pp_service(serv: &[(String, Type)]) -> RcDoc { fn pp_defs(env: &TypeEnv) -> RcDoc { lines(env.0.iter() - .filter(|(id, _)|{ !(*id == "blob") }) + .filter(|(id, _)|{ *id != "blob" }) .map(|(id, ty)| { kwd("type") .append(ident(id)) diff --git a/rust/candid_parser/src/bindings/javascript.rs b/rust/candid_parser/src/bindings/javascript.rs index f46cb237..6f7e1725 100644 --- a/rust/candid_parser/src/bindings/javascript.rs +++ b/rust/candid_parser/src/bindings/javascript.rs @@ -206,7 +206,7 @@ fn pp_defs<'a>( .map(|id| kwd("const").append(ident(id)).append(" = IDL.Rec();")), ); let defs = lines(def_list.iter(). - filter(|id|{ !(**id == "blob") }). + filter(|id|{ **id != "blob" }). map(|id| { let ty = env.find_type(id).unwrap(); if recs.contains(id) { diff --git a/rust/candid_parser/src/bindings/motoko.rs b/rust/candid_parser/src/bindings/motoko.rs index 8c4e5320..d3359def 100644 --- a/rust/candid_parser/src/bindings/motoko.rs +++ b/rust/candid_parser/src/bindings/motoko.rs @@ -227,7 +227,7 @@ fn pp_service(serv: &[(String, Type)]) -> RcDoc { fn pp_defs(env: &TypeEnv) -> RcDoc { lines(env.0.iter(). - filter(|(id, _)|{ !(*id == "blob") }). + filter(|(id, _)|{ *id != "blob" }). map(|(id, ty)| { kwd("public type") .append(escape(id, false)) diff --git a/rust/candid_parser/src/bindings/rust.rs b/rust/candid_parser/src/bindings/rust.rs index 238b2106..7dd466d8 100644 --- a/rust/candid_parser/src/bindings/rust.rs +++ b/rust/candid_parser/src/bindings/rust.rs @@ -125,14 +125,13 @@ fn pp_ty<'a>(ty: &'a Type, recs: &RecPoints) -> RcDoc<'a> { Var(ref id) => { if id == "blob" { str("serde_bytes::ByteBuf") - } - else { - let name = ident(id, Some(Case::Pascal)); - if recs.contains(id.as_str()) { - str("Box<").append(name).append(">") } else { - name - } + let name = ident(id, Some(Case::Pascal)); + if recs.contains(id.as_str()) { + str("Box<").append(name).append(">") + } else { + name + } } } Principal => str("Principal"), @@ -225,7 +224,7 @@ fn pp_defs<'a>( &config.type_attributes }; lines(def_list.iter(). - filter(|id|{ !(**id == "blob") }). + filter(|id|{ **id != "blob" }). map(|id| { let ty = env.find_type(id).unwrap(); let name = ident(id, Some(Case::Pascal)).append(" "); diff --git a/rust/candid_parser/src/bindings/typescript.rs b/rust/candid_parser/src/bindings/typescript.rs index 748a10c7..941dfa79 100644 --- a/rust/candid_parser/src/bindings/typescript.rs +++ b/rust/candid_parser/src/bindings/typescript.rs @@ -26,13 +26,12 @@ fn pp_ty<'a>(env: &'a TypeEnv, ty: &'a Type, is_ref: bool) -> RcDoc<'a> { Var(ref id) => { if id == "blob" { str("Uint8Array | number[]") - } else - if is_ref { + } else if is_ref { let ty = env.rec_find_type(id).unwrap(); if matches!(ty.as_ref(), Service(_) | Func(_)) { pp_ty(env, ty, false) } else { - ident(id) + ident(id) } } else { ident(id) @@ -146,7 +145,7 @@ fn pp_service<'a>(env: &'a TypeEnv, serv: &'a [(String, Type)]) -> RcDoc<'a> { fn pp_defs<'a>(env: &'a TypeEnv, def_list: &'a [&'a str]) -> RcDoc<'a> { lines(def_list.iter(). - filter(|id|{ !(**id == "blob") }). + filter(|id|{ **id != "blob" }). map(|id| { let ty = env.find_type(id).unwrap(); let export = match ty.as_ref() {