1
Fork 0

Fix uninlined_format_args for some compiler crates

Convert all the crates that have had their diagnostic migration
completed (except save_analysis because that will be deleted soon and
apfloat because of the licensing problem).
This commit is contained in:
nils 2022-12-19 10:31:55 +01:00 committed by Nilstrieb
parent 1d284af117
commit fd7a159710
91 changed files with 287 additions and 329 deletions

View file

@ -277,12 +277,12 @@ impl<Node: Idx> Dominators<Node> {
}
pub fn immediate_dominator(&self, node: Node) -> Node {
assert!(self.is_reachable(node), "node {:?} is not reachable", node);
assert!(self.is_reachable(node), "node {node:?} is not reachable");
self.immediate_dominators[node].unwrap()
}
pub fn dominators(&self, node: Node) -> Iter<'_, Node> {
assert!(self.is_reachable(node), "node {:?} is not reachable", node);
assert!(self.is_reachable(node), "node {node:?} is not reachable");
Iter { dominators: self, node: Some(node) }
}

View file

@ -233,10 +233,9 @@ where
.map(G::Node::new)
.map(|node| match this.start_walk_from(node) {
WalkReturn::Complete { scc_index } => scc_index,
WalkReturn::Cycle { min_depth } => panic!(
"`start_walk_node({:?})` returned cycle with depth {:?}",
node, min_depth
),
WalkReturn::Cycle { min_depth } => {
panic!("`start_walk_node({node:?})` returned cycle with depth {min_depth:?}")
}
})
.collect();
@ -272,8 +271,7 @@ where
NodeState::NotVisited => return None,
NodeState::InCycleWith { parent } => panic!(
"`find_state` returned `InCycleWith({:?})`, which ought to be impossible",
parent
"`find_state` returned `InCycleWith({parent:?})`, which ought to be impossible"
),
})
}
@ -369,7 +367,7 @@ where
previous_node = previous;
}
// Only InCycleWith nodes were added to the reverse linked list.
other => panic!("Invalid previous link while compressing cycle: {:?}", other),
other => panic!("Invalid previous link while compressing cycle: {other:?}"),
}
debug!("find_state: parent_state = {:?}", node_state);
@ -394,7 +392,7 @@ where
// NotVisited can not be part of a cycle since it should
// have instead gotten explored.
NodeState::NotVisited | NodeState::InCycleWith { .. } => {
panic!("invalid parent state: {:?}", node_state)
panic!("invalid parent state: {node_state:?}")
}
}
}

View file

@ -30,7 +30,7 @@ impl<O: ForestObligation> ObligationForest<O> {
let counter = COUNTER.fetch_add(1, Ordering::AcqRel);
let file_path = dir.as_ref().join(format!("{:010}_{}.gv", counter, description));
let file_path = dir.as_ref().join(format!("{counter:010}_{description}.gv"));
let mut gv_file = BufWriter::new(File::create(file_path).unwrap());
@ -47,7 +47,7 @@ impl<'a, O: ForestObligation + 'a> dot::Labeller<'a> for &'a ObligationForest<O>
}
fn node_id(&self, index: &Self::Node) -> dot::Id<'_> {
dot::Id::new(format!("obligation_{}", index)).unwrap()
dot::Id::new(format!("obligation_{index}")).unwrap()
}
fn node_label(&self, index: &Self::Node) -> dot::LabelText<'_> {

View file

@ -545,7 +545,7 @@ impl SelfProfiler {
// length can behave as a source of entropy for heap addresses, when
// ASLR is disabled and the heap is otherwise determinic.
let pid: u32 = process::id();
let filename = format!("{}-{:07}.rustc_profile", crate_name, pid);
let filename = format!("{crate_name}-{pid:07}.rustc_profile");
let path = output_directory.join(&filename);
let profiler =
Profiler::with_counter(&path, measureme::counters::Counter::by_name(counter_name)?)?;

View file

@ -30,7 +30,7 @@ impl SmallCStr {
SmallVec::from_vec(data)
};
if let Err(e) = ffi::CStr::from_bytes_with_nul(&data) {
panic!("The string \"{}\" cannot be converted into a CStr: {}", s, e);
panic!("The string \"{s}\" cannot be converted into a CStr: {e}");
}
SmallCStr { data }
}
@ -39,7 +39,7 @@ impl SmallCStr {
pub fn new_with_nul(s: &str) -> SmallCStr {
let b = s.as_bytes();
if let Err(e) = ffi::CStr::from_bytes_with_nul(b) {
panic!("The string \"{}\" cannot be converted into a CStr: {}", s, e);
panic!("The string \"{s}\" cannot be converted into a CStr: {e}");
}
SmallCStr { data: SmallVec::from_slice(s.as_bytes()) }
}
@ -74,7 +74,7 @@ impl<'a> FromIterator<&'a str> for SmallCStr {
iter.into_iter().flat_map(|s| s.as_bytes()).copied().collect::<SmallVec<_>>();
data.push(0);
if let Err(e) = ffi::CStr::from_bytes_with_nul(&data) {
panic!("The iterator {:?} cannot be converted into a CStr: {}", data, e);
panic!("The iterator {data:?} cannot be converted into a CStr: {e}");
}
Self { data }
}

View file

@ -71,8 +71,7 @@ where
// This should return just one element, otherwise it's a bug
assert!(
filter.next().is_none(),
"Collection {:#?} should have just one matching element",
self
"Collection {self:#?} should have just one matching element"
);
Some(value)
}