Skip to content

Commit 6f78bf2

Browse files
authored
Rollup merge of #123599 - matthiaskrgr:rm, r=cjgillot
remove some things that do not need to be
2 parents 46961d2 + f9ca213 commit 6f78bf2

File tree

7 files changed

+10
-18
lines changed

7 files changed

+10
-18
lines changed

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
960960
sm.span_to_diagnostic_string(span)
961961
}
962962
};
963-
let mut spans: MultiSpan = spans.clone().into();
963+
let mut spans: MultiSpan = spans.into();
964964
// Point at all the `continue`s and explicit `break`s in the relevant loops.
965965
for (desc, elements) in [
966966
("`break` exits", &finder.found_breaks),

compiler/rustc_builtin_macros/src/source_util.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,8 @@ fn find_path_suggestion(
333333
.flatten()
334334
.take(4);
335335

336-
for new_path in root_absolute.chain(add).chain(remove) {
337-
if source_map.file_exists(&base_dir.join(&new_path)) {
338-
return Some(new_path);
339-
}
340-
}
341-
None
336+
root_absolute
337+
.chain(add)
338+
.chain(remove)
339+
.find(|new_path| source_map.file_exists(&base_dir.join(&new_path)))
342340
}

compiler/rustc_feature/src/builtin_attrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ pub fn is_builtin_attr_name(name: Symbol) -> bool {
10821082
/// This means it can be used cross crate.
10831083
pub fn encode_cross_crate(name: Symbol) -> bool {
10841084
if let Some(attr) = BUILTIN_ATTRIBUTE_MAP.get(&name) {
1085-
if attr.encode_cross_crate == EncodeCrossCrate::Yes { true } else { false }
1085+
attr.encode_cross_crate == EncodeCrossCrate::Yes
10861086
} else {
10871087
true
10881088
}

compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
11341134
for (what, span) in types_and_spans {
11351135
err.span_label(span, format!("not allowed on {what}"));
11361136
}
1137-
generics_args_err_extend(self.tcx(), segments.clone(), &mut err, err_extend);
1137+
generics_args_err_extend(self.tcx(), segments, &mut err, err_extend);
11381138
let reported = err.emit();
11391139
self.set_tainted_by_errors(reported);
11401140
reported

compiler/rustc_metadata/src/rmeta/encoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2009,7 +2009,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
20092009
.push((id.owner_id.def_id.local_def_index, simplified_self_ty));
20102010

20112011
let trait_def = tcx.trait_def(trait_ref.def_id);
2012-
if let Some(mut an) = trait_def.ancestors(tcx, def_id).ok() {
2012+
if let Ok(mut an) = trait_def.ancestors(tcx, def_id) {
20132013
if let Some(specialization_graph::Node::Impl(parent)) = an.nth(1) {
20142014
self.tables.impl_parent.set_some(def_id.index, parent.into());
20152015
}

compiler/rustc_parse/src/parser/expr.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3585,8 +3585,7 @@ impl<'a> Parser<'a> {
35853585

35863586
match self.expect_one_of(&[token::Comma], &[token::CloseDelim(close_delim)]) {
35873587
Ok(_) => {
3588-
if let Some(f) =
3589-
parsed_field.or_else(|guar| field_ident(self, guar).ok_or(guar)).ok()
3588+
if let Ok(f) = parsed_field.or_else(|guar| field_ident(self, guar).ok_or(guar))
35903589
{
35913590
// Only include the field if there's no parse error for the field name.
35923591
fields.push(f);

compiler/rustc_query_system/src/dep_graph/serialized.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -541,12 +541,7 @@ impl<D: Deps> EncoderState<D> {
541541
record_graph: &Option<Lock<DepGraphQuery>>,
542542
) -> DepNodeIndex {
543543
node.encode::<D>(&mut self.encoder);
544-
self.record(
545-
node.node,
546-
node.edges.len(),
547-
|_| node.edges[..].iter().copied().collect(),
548-
record_graph,
549-
)
544+
self.record(node.node, node.edges.len(), |_| node.edges[..].to_vec(), record_graph)
550545
}
551546

552547
/// Encodes a node that was promoted from the previous graph. It reads the information directly from

0 commit comments

Comments
 (0)