Skip to content

remove some things that do not need to be #123599

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

Merged
merged 1 commit into from
Apr 12, 2024
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 compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
10 changes: 4 additions & 6 deletions compiler/rustc_builtin_macros/src/source_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
}
2 changes: 1 addition & 1 deletion compiler/rustc_feature/src/builtin_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_metadata/src/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_parse/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 1 addition & 6 deletions compiler/rustc_query_system/src/dep_graph/serialized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading