diff --git a/crates/mun_codegen/src/code_gen/assembly_builder.rs b/crates/mun_codegen/src/code_gen/assembly_builder.rs index e36fb22ea..1b29d353b 100644 --- a/crates/mun_codegen/src/code_gen/assembly_builder.rs +++ b/crates/mun_codegen/src/code_gen/assembly_builder.rs @@ -29,9 +29,9 @@ impl<'db, 'ink, 'ctx, 't> AssemblyBuilder<'db, 'ink, 'ctx, 't> { Self { code_gen, + module_group_partition, module_group_id, assembly_module, - module_group_partition, } } diff --git a/crates/mun_codegen/src/module_group.rs b/crates/mun_codegen/src/module_group.rs index 85d72e441..25af5e2df 100644 --- a/crates/mun_codegen/src/module_group.rs +++ b/crates/mun_codegen/src/module_group.rs @@ -53,9 +53,9 @@ impl ModuleGroup { Self { ordered_modules, - name, - includes_entire_subtree, modules, + includes_entire_subtree, + name, } } diff --git a/crates/mun_hir/src/module_tree.rs b/crates/mun_hir/src/module_tree.rs index bd869ddb0..656625dc1 100644 --- a/crates/mun_hir/src/module_tree.rs +++ b/crates/mun_hir/src/module_tree.rs @@ -110,10 +110,10 @@ impl ModuleTree { } Arc::new(ModuleTree { + root, + modules, package, diagnostics, - modules, - root, }) } diff --git a/crates/mun_hir/src/name_resolution/path_resolution.rs b/crates/mun_hir/src/name_resolution/path_resolution.rs index c01d9937c..c5991fbbc 100644 --- a/crates/mun_hir/src/name_resolution/path_resolution.rs +++ b/crates/mun_hir/src/name_resolution/path_resolution.rs @@ -41,8 +41,8 @@ impl ResolvePathResult { ) -> ResolvePathResult { ResolvePathResult { resolved_def, - reached_fixedpoint, segment_index, + reached_fixedpoint, package, } } diff --git a/crates/mun_language_server/src/state.rs b/crates/mun_language_server/src/state.rs index eef667d4b..abaf28ba4 100644 --- a/crates/mun_language_server/src/state.rs +++ b/crates/mun_language_server/src/state.rs @@ -347,10 +347,7 @@ impl LanguageServerState { .file_contents(file.file_id) .map(Vec::from) .unwrap_or_default(); - let text = match String::from_utf8(bytes).ok() { - Some(text) => Some(Arc::from(text)), - None => None, - }; + let text = String::from_utf8(bytes).ok().map(Arc::from); // Notify the database about this change analysis_change.change_file(hir::FileId(file.file_id.0), text); diff --git a/crates/mun_memory/src/diff.rs b/crates/mun_memory/src/diff.rs index 12a5d664f..7af7c6e70 100644 --- a/crates/mun_memory/src/diff.rs +++ b/crates/mun_memory/src/diff.rs @@ -131,6 +131,7 @@ fn append_primitive_mapping( let mut insertions: Vec> = insertions.into_iter().map(Some).collect(); // For all deletions, + #[allow(clippy::manual_flatten)] 'outer: for old_idx in deletions { let old_ty = unsafe { old.get_unchecked(old_idx) }; // is there an insertion @@ -154,10 +155,8 @@ fn append_primitive_mapping( } // If an insertion did not have a matching deletion, then `Insert` it. - for insertion in insertions { - if let Some(index) = insertion { - mapping.push(Diff::Insert { index }); - } + for index in insertions.into_iter().flatten() { + mapping.push(Diff::Insert { index }); } } @@ -296,6 +295,7 @@ where let mut mapping = Vec::with_capacity(diff.len()); // For all deletions, + #[allow(clippy::manual_flatten)] 'outer: for old_idx in deletions { let old_ty = unsafe { old.get_unchecked(old_idx) }; // is there an insertion with the same name and type `T`? @@ -391,10 +391,8 @@ where } // If an insertion did not have a matching deletion, then insert it. - for insertion in insertions { - if let Some(index) = insertion { - mapping.push(FieldDiff::Insert { index }); - } + for index in insertions.into_iter().flatten() { + mapping.push(FieldDiff::Insert { index }); } mapping.shrink_to_fit(); diff --git a/crates/mun_runtime/src/adt.rs b/crates/mun_runtime/src/adt.rs index 658788468..970f1f744 100644 --- a/crates/mun_runtime/src/adt.rs +++ b/crates/mun_runtime/src/adt.rs @@ -310,7 +310,7 @@ impl RootedStruct { GcRootPtr::new(&runtime_ref.gc, raw.0) }; - Self { runtime, handle } + Self { handle, runtime } } /// Converts the `RootedStruct` into a `StructRef`, using an external shared reference to a diff --git a/crates/mun_syntax/src/ast/expr_extensions.rs b/crates/mun_syntax/src/ast/expr_extensions.rs index 9db683a7c..39f95dcd9 100644 --- a/crates/mun_syntax/src/ast/expr_extensions.rs +++ b/crates/mun_syntax/src/ast/expr_extensions.rs @@ -176,10 +176,8 @@ impl ast::FieldExpr { pub fn field_access(&self) -> Option { if let Some(nr) = self.name_ref() { Some(FieldKind::Name(nr)) - } else if let Some(tok) = self.index_token() { - Some(FieldKind::Index(tok)) } else { - None + self.index_token().map(FieldKind::Index) } } diff --git a/rust-toolchain b/rust-toolchain index ba0a71911..a63cb35e6 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.51.0 +1.52.0