Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump: rust to 1.52.0 #327

Merged
merged 1 commit into from
May 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/mun_codegen/src/code_gen/assembly_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/mun_codegen/src/module_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ impl ModuleGroup {

Self {
ordered_modules,
name,
includes_entire_subtree,
modules,
includes_entire_subtree,
name,
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/mun_hir/src/module_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ impl ModuleTree {
}

Arc::new(ModuleTree {
root,
modules,
package,
diagnostics,
modules,
root,
})
}

Expand Down
2 changes: 1 addition & 1 deletion crates/mun_hir/src/name_resolution/path_resolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ impl ResolvePathResult {
) -> ResolvePathResult {
ResolvePathResult {
resolved_def,
reached_fixedpoint,
segment_index,
reached_fixedpoint,
package,
}
}
Expand Down
5 changes: 1 addition & 4 deletions crates/mun_language_server/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 6 additions & 8 deletions crates/mun_memory/src/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ fn append_primitive_mapping<T>(
let mut insertions: Vec<Option<usize>> = 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
Expand All @@ -154,10 +155,8 @@ fn append_primitive_mapping<T>(
}

// 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 });
}
}

Expand Down Expand Up @@ -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`?
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion crates/mun_runtime/src/adt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions crates/mun_syntax/src/ast/expr_extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,8 @@ impl ast::FieldExpr {
pub fn field_access(&self) -> Option<FieldKind> {
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)
}
}

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.51.0
1.52.0