Skip to content

Commit 2bda0c1

Browse files
committed
nll: improve format operations
1 parent e62ce98 commit 2bda0c1

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ impl<'tcx> BorrowExplanation<'tcx> {
8787
// Otherwise, just report the whole type (and use
8888
// the intentionally fuzzy phrase "destructor")
8989
ty::Closure(..) =>
90-
("destructor", format!("closure")),
90+
("destructor", "closure".to_owned()),
9191
ty::Generator(..) =>
92-
("destructor", format!("generator")),
92+
("destructor", "generator".to_owned()),
9393

9494
_ => ("destructor", format!("type `{}`", local_decl.ty)),
9595
};

src/librustc_mir/borrow_check/nll/region_infer/dump_mir.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
3636
let outlived_by = self.universal_region_relations.regions_outlived_by(region);
3737
writeln!(
3838
out,
39-
"| {r:rw$} | {c:cw$} | {ob}",
40-
r = format!("{:?}", region),
39+
"| {r:rw$?} | {c:cw$?} | {ob:?}",
40+
r = region,
4141
rw = REGION_WIDTH,
42-
c = format!("{:?}", classification),
42+
c = classification,
4343
cw = 8, // "External" at most
44-
ob = format!("{:?}", outlived_by)
44+
ob = outlived_by
4545
)?;
4646
}
4747
}
@@ -51,8 +51,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
5151
for region in self.regions() {
5252
writeln!(
5353
out,
54-
"| {r:rw$} | {ui:4?} | {v}",
55-
r = format!("{:?}", region),
54+
"| {r:rw$?} | {ui:4?} | {v}",
55+
r = region,
5656
rw = REGION_WIDTH,
5757
ui = self.region_universe(region),
5858
v = self.region_value_str(region),

src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
550550
let span = infcx.tcx.def_span(*did);
551551
if let Ok(snippet) = infcx.tcx.sess.source_map().span_to_snippet(span) {
552552
let suggestable_fr_name = if fr_name.was_named() {
553-
format!("{}", fr_name)
553+
fr_name.to_string()
554554
} else {
555555
"'_".to_string()
556556
};

0 commit comments

Comments
 (0)