diff options
Diffstat (limited to 'compiler/rustc_mir_dataflow/src')
7 files changed, 28 insertions, 31 deletions
diff --git a/compiler/rustc_mir_dataflow/src/framework/direction.rs b/compiler/rustc_mir_dataflow/src/framework/direction.rs index 5ff6b9e7e69..077a21fc8af 100644 --- a/compiler/rustc_mir_dataflow/src/framework/direction.rs +++ b/compiler/rustc_mir_dataflow/src/framework/direction.rs @@ -287,7 +287,7 @@ impl Direction for Backward { | mir::TerminatorKind::InlineAsm { cleanup: Some(unwind), .. } if unwind == bb => { - if dead_unwinds.map_or(true, |dead| !dead.contains(bb)) { + if dead_unwinds.map_or(true, |dead| !dead.contains(pred)) { propagate(pred, exit_state); } } diff --git a/compiler/rustc_mir_dataflow/src/framework/fmt.rs b/compiler/rustc_mir_dataflow/src/framework/fmt.rs index 209e6f7ac9f..490be166a91 100644 --- a/compiler/rustc_mir_dataflow/src/framework/fmt.rs +++ b/compiler/rustc_mir_dataflow/src/framework/fmt.rs @@ -143,7 +143,7 @@ where ", " }; - write!(f, "{}", delim)?; + write!(f, "{delim}")?; idx.fmt_with(ctxt, f)?; first = false; } @@ -164,7 +164,7 @@ where ", " }; - write!(f, "{}", delim)?; + write!(f, "{delim}")?; idx.fmt_with(ctxt, f)?; first = false; } diff --git a/compiler/rustc_mir_dataflow/src/framework/graphviz.rs b/compiler/rustc_mir_dataflow/src/framework/graphviz.rs index c9d5601f207..96c42894b69 100644 --- a/compiler/rustc_mir_dataflow/src/framework/graphviz.rs +++ b/compiler/rustc_mir_dataflow/src/framework/graphviz.rs @@ -71,7 +71,7 @@ where fn graph_id(&self) -> dot::Id<'_> { let name = graphviz_safe_def_name(self.body.source.def_id()); - dot::Id::new(format!("graph_for_def_id_{}", name)).unwrap() + dot::Id::new(format!("graph_for_def_id_{name}")).unwrap() } fn node_id(&self, n: &Self::Node) -> dot::Id<'_> { @@ -190,7 +190,7 @@ where " cellpadding=\"3\"", " sides=\"rb\"", ); - write!(w, r#"<table{fmt}>"#, fmt = table_fmt)?; + write!(w, r#"<table{table_fmt}>"#)?; // A + B: Block header match self.style { @@ -372,7 +372,7 @@ where write!(w, concat!("<tr>", r#"<td colspan="2" {fmt}>MIR</td>"#,), fmt = fmt,)?; for name in state_column_names { - write!(w, "<td {fmt}>{name}</td>", fmt = fmt, name = name)?; + write!(w, "<td {fmt}>{name}</td>")?; } write!(w, "</tr>") @@ -394,18 +394,18 @@ where }; for (i, statement) in body[block].statements.iter().enumerate() { - let statement_str = format!("{:?}", statement); - let index_str = format!("{}", i); + let statement_str = format!("{statement:?}"); + let index_str = format!("{i}"); let after = next_in_dataflow_order(&mut afters); let before = befores.as_mut().map(next_in_dataflow_order); self.write_row(w, &index_str, &statement_str, |_this, w, fmt| { if let Some(before) = before { - write!(w, r#"<td {fmt} align="left">{diff}</td>"#, fmt = fmt, diff = before)?; + write!(w, r#"<td {fmt} align="left">{before}</td>"#)?; } - write!(w, r#"<td {fmt} align="left">{diff}</td>"#, fmt = fmt, diff = after) + write!(w, r#"<td {fmt} align="left">{after}</td>"#) })?; } @@ -421,10 +421,10 @@ where self.write_row(w, "T", &terminator_str, |_this, w, fmt| { if let Some(before) = before { - write!(w, r#"<td {fmt} align="left">{diff}</td>"#, fmt = fmt, diff = before)?; + write!(w, r#"<td {fmt} align="left">{before}</td>"#)?; } - write!(w, r#"<td {fmt} align="left">{diff}</td>"#, fmt = fmt, diff = after) + write!(w, r#"<td {fmt} align="left">{after}</td>"#) }) } diff --git a/compiler/rustc_mir_dataflow/src/impls/liveness.rs b/compiler/rustc_mir_dataflow/src/impls/liveness.rs index 3e08a8799ef..923dc16c11b 100644 --- a/compiler/rustc_mir_dataflow/src/impls/liveness.rs +++ b/compiler/rustc_mir_dataflow/src/impls/liveness.rs @@ -149,7 +149,7 @@ enum DefUse { } impl DefUse { - fn apply<'tcx>(trans: &mut impl GenKill<Local>, place: Place<'tcx>, context: PlaceContext) { + fn apply(trans: &mut impl GenKill<Local>, place: Place<'_>, context: PlaceContext) { match DefUse::for_place(place, context) { Some(DefUse::Def) => trans.kill(place.local), Some(DefUse::Use) => trans.gen(place.local), @@ -157,7 +157,7 @@ impl DefUse { } } - fn for_place<'tcx>(place: Place<'tcx>, context: PlaceContext) -> Option<DefUse> { + fn for_place(place: Place<'_>, context: PlaceContext) -> Option<DefUse> { match context { PlaceContext::NonUse(_) => None, diff --git a/compiler/rustc_mir_dataflow/src/move_paths/abs_domain.rs b/compiler/rustc_mir_dataflow/src/move_paths/abs_domain.rs index 5cfbbb1ac01..7806e8f45d3 100644 --- a/compiler/rustc_mir_dataflow/src/move_paths/abs_domain.rs +++ b/compiler/rustc_mir_dataflow/src/move_paths/abs_domain.rs @@ -18,7 +18,7 @@ use rustc_middle::ty::Ty; pub struct AbstractOperand; #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] pub struct AbstractType; -pub type AbstractElem = ProjectionElem<AbstractOperand, AbstractType, AbstractType>; +pub type AbstractElem = ProjectionElem<AbstractOperand, AbstractType>; pub trait Lift { type Abstract; diff --git a/compiler/rustc_mir_dataflow/src/move_paths/mod.rs b/compiler/rustc_mir_dataflow/src/move_paths/mod.rs index b36e268cf8b..5f22a418de8 100644 --- a/compiler/rustc_mir_dataflow/src/move_paths/mod.rs +++ b/compiler/rustc_mir_dataflow/src/move_paths/mod.rs @@ -14,9 +14,8 @@ use self::abs_domain::{AbstractElem, Lift}; mod abs_domain; rustc_index::newtype_index! { - pub struct MovePathIndex { - DEBUG_FORMAT = "mp{}" - } + #[debug_format = "mp{}"] + pub struct MovePathIndex {} } impl polonius_engine::Atom for MovePathIndex { @@ -26,15 +25,13 @@ impl polonius_engine::Atom for MovePathIndex { } rustc_index::newtype_index! { - pub struct MoveOutIndex { - DEBUG_FORMAT = "mo{}" - } + #[debug_format = "mo{}"] + pub struct MoveOutIndex {} } rustc_index::newtype_index! { - pub struct InitIndex { - DEBUG_FORMAT = "in{}" - } + #[debug_format = "in{}"] + pub struct InitIndex {} } impl MoveOutIndex { @@ -132,13 +129,13 @@ impl<'tcx> fmt::Debug for MovePath<'tcx> { fn fmt(&self, w: &mut fmt::Formatter<'_>) -> fmt::Result { write!(w, "MovePath {{")?; if let Some(parent) = self.parent { - write!(w, " parent: {:?},", parent)?; + write!(w, " parent: {parent:?},")?; } if let Some(first_child) = self.first_child { - write!(w, " first_child: {:?},", first_child)?; + write!(w, " first_child: {first_child:?},")?; } if let Some(next_sibling) = self.next_sibling { - write!(w, " next_sibling: {:?}", next_sibling)?; + write!(w, " next_sibling: {next_sibling:?}")?; } write!(w, " place: {:?} }}", self.place) } diff --git a/compiler/rustc_mir_dataflow/src/value_analysis.rs b/compiler/rustc_mir_dataflow/src/value_analysis.rs index ab16b60f82d..0522c657939 100644 --- a/compiler/rustc_mir_dataflow/src/value_analysis.rs +++ b/compiler/rustc_mir_dataflow/src/value_analysis.rs @@ -777,10 +777,10 @@ pub enum TrackElem { Field(Field), } -impl<V, T1, T2> TryFrom<ProjectionElem<V, T1, T2>> for TrackElem { +impl<V, T> TryFrom<ProjectionElem<V, T>> for TrackElem { type Error = (); - fn try_from(value: ProjectionElem<V, T1, T2>) -> Result<Self, Self::Error> { + fn try_from(value: ProjectionElem<V, T>) -> Result<Self, Self::Error> { match value { ProjectionElem::Field(field, _) => Ok(TrackElem::Field(field)), _ => Err(()), @@ -823,7 +823,7 @@ fn iter_fields<'tcx>( } /// Returns all locals with projections that have their reference or address taken. -fn excluded_locals<'tcx>(body: &Body<'tcx>) -> IndexVec<Local, bool> { +fn excluded_locals(body: &Body<'_>) -> IndexVec<Local, bool> { struct Collector { result: IndexVec<Local, bool>, } @@ -920,7 +920,7 @@ fn debug_with_context<V: Debug + Eq>( ) -> std::fmt::Result { for (local, place) in map.locals.iter_enumerated() { if let Some(place) = place { - debug_with_context_rec(*place, &format!("{:?}", local), new, old, map, f)?; + debug_with_context_rec(*place, &format!("{local:?}"), new, old, map, f)?; } } Ok(()) |
