diff --git a/ligen/ir/src/types/type_.rs b/ligen/ir/src/types/type_.rs index 20ad2adf..e927bd5d 100644 --- a/ligen/ir/src/types/type_.rs +++ b/ligen/ir/src/types/type_.rs @@ -35,7 +35,7 @@ impl Type { /// Returns a new `Type` representing an array type. pub fn array(type_: impl Into, length: usize) -> Self { - let path = Path::from(PathSegment::new(Identifier::array(), type_.into())).into(); + let path = Path::from(PathSegment::new(Identifier::array(), type_.into())); let length = Some(length); Self { path, length } } diff --git a/ligen/parser/src/parser/universal/attributes/attribute/intermediary_attribute/mod.rs b/ligen/parser/src/parser/universal/attributes/attribute/intermediary_attribute/mod.rs index 0f13dca2..a7f5cea3 100644 --- a/ligen/parser/src/parser/universal/attributes/attribute/intermediary_attribute/mod.rs +++ b/ligen/parser/src/parser/universal/attributes/attribute/intermediary_attribute/mod.rs @@ -9,12 +9,10 @@ impl syn::parse::Parse for IntermediaryAttribute { fn parse(input: syn::parse::ParseStream) -> syn::Result { if input.peek(syn::Lit) { input.parse().map(IntermediaryAttribute::Lit) + } else if let Ok(attribute) = input.parse().map(IntermediaryAttribute::Expr) { + Ok(attribute) } else { - if let Ok(attribute) = input.parse().map(IntermediaryAttribute::Expr) { - Ok(attribute) - } else { - Ok(input.parse().map(IntermediaryAttribute::Meta).unwrap_or(IntermediaryAttribute::Unknown(input.to_string()))) - } + Ok(input.parse().map(IntermediaryAttribute::Meta).unwrap_or(IntermediaryAttribute::Unknown(input.to_string()))) } } } diff --git a/tools/editor/src/gui/ui/layout/editor/ir/mod.rs b/tools/editor/src/gui/ui/layout/editor/ir/mod.rs index 01bb1c2b..bc56128b 100644 --- a/tools/editor/src/gui/ui/layout/editor/ir/mod.rs +++ b/tools/editor/src/gui/ui/layout/editor/ir/mod.rs @@ -88,7 +88,7 @@ impl Pane for Editor { ui.label("Filter"); ui.text_edit_singleline(&mut self.filter); }); - List::new("Symbols").show(ui, &mut self.symbols.symbols.iter_mut().filter(|symbol| symbol.to_string().contains(self.filter.as_str())), |ui, symbol| { + List::new("Symbols").show(ui, self.symbols.symbols.iter_mut().filter(|symbol| symbol.to_string().contains(self.filter.as_str())), |ui, symbol| { ui.label(symbol.to_string()); }); UiResponse::None diff --git a/tools/editor/src/gui/ui/utils/string_editable_field/string_editable.rs b/tools/editor/src/gui/ui/utils/string_editable_field/string_editable.rs index a0a407dd..a23a94c2 100644 --- a/tools/editor/src/gui/ui/utils/string_editable_field/string_editable.rs +++ b/tools/editor/src/gui/ui/utils/string_editable_field/string_editable.rs @@ -14,12 +14,8 @@ impl StringEditable for PathBuf { } fn update(&mut self, string: impl AsRef) -> bool { - if let Ok(path_buf) = PathBuf::try_from(string.as_ref()) { - *self = path_buf; - true - } else { - false - } + *self = PathBuf::from(string.as_ref()); + true } } @@ -55,12 +51,8 @@ impl StringEditable for VersionRequirement { } fn update(&mut self, string: impl AsRef) -> bool { - if let Ok(version) = VersionRequirement::try_from(string.as_ref()) { - *self = version; - true - } else { - false - } + *self = VersionRequirement::from(string.as_ref()); + true } }