remove some things that do not need to be

This commit is contained in:
Matthias Krüger 2024-04-07 17:59:11 +02:00
parent df7daa815f
commit f9ca213510
7 changed files with 10 additions and 18 deletions

View File

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

View File

@ -333,10 +333,8 @@ fn find_path_suggestion(
.flatten()
.take(4);
for new_path in root_absolute.chain(add).chain(remove) {
if source_map.file_exists(&base_dir.join(&new_path)) {
return Some(new_path);
}
}
None
root_absolute
.chain(add)
.chain(remove)
.find(|new_path| source_map.file_exists(&base_dir.join(&new_path)))
}

View File

@ -1082,7 +1082,7 @@ pub fn is_builtin_attr_name(name: Symbol) -> bool {
/// This means it can be used cross crate.
pub fn encode_cross_crate(name: Symbol) -> bool {
if let Some(attr) = BUILTIN_ATTRIBUTE_MAP.get(&name) {
if attr.encode_cross_crate == EncodeCrossCrate::Yes { true } else { false }
attr.encode_cross_crate == EncodeCrossCrate::Yes
} else {
true
}

View File

@ -1134,7 +1134,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
for (what, span) in types_and_spans {
err.span_label(span, format!("not allowed on {what}"));
}
generics_args_err_extend(self.tcx(), segments.clone(), &mut err, err_extend);
generics_args_err_extend(self.tcx(), segments, &mut err, err_extend);
let reported = err.emit();
self.set_tainted_by_errors(reported);
reported

View File

@ -2009,7 +2009,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
.push((id.owner_id.def_id.local_def_index, simplified_self_ty));
let trait_def = tcx.trait_def(trait_ref.def_id);
if let Some(mut an) = trait_def.ancestors(tcx, def_id).ok() {
if let Ok(mut an) = trait_def.ancestors(tcx, def_id) {
if let Some(specialization_graph::Node::Impl(parent)) = an.nth(1) {
self.tables.impl_parent.set_some(def_id.index, parent.into());
}

View File

@ -3585,8 +3585,7 @@ impl<'a> Parser<'a> {
match self.expect_one_of(&[token::Comma], &[token::CloseDelim(close_delim)]) {
Ok(_) => {
if let Some(f) =
parsed_field.or_else(|guar| field_ident(self, guar).ok_or(guar)).ok()
if let Ok(f) = parsed_field.or_else(|guar| field_ident(self, guar).ok_or(guar))
{
// Only include the field if there's no parse error for the field name.
fields.push(f);

View File

@ -541,12 +541,7 @@ impl<D: Deps> EncoderState<D> {
record_graph: &Option<Lock<DepGraphQuery>>,
) -> DepNodeIndex {
node.encode::<D>(&mut self.encoder);
self.record(
node.node,
node.edges.len(),
|_| node.edges[..].iter().copied().collect(),
record_graph,
)
self.record(node.node, node.edges.len(), |_| node.edges[..].to_vec(), record_graph)
}
/// Encodes a node that was promoted from the previous graph. It reads the information directly from