1
Fork 0

nll: improve format operations

This commit is contained in:
ljedrz 2018-10-17 16:54:17 +02:00
parent e62ce98009
commit 2bda0c196f
3 changed files with 9 additions and 9 deletions

View file

@ -87,9 +87,9 @@ impl<'tcx> BorrowExplanation<'tcx> {
// Otherwise, just report the whole type (and use
// the intentionally fuzzy phrase "destructor")
ty::Closure(..) =>
("destructor", format!("closure")),
("destructor", "closure".to_owned()),
ty::Generator(..) =>
("destructor", format!("generator")),
("destructor", "generator".to_owned()),
_ => ("destructor", format!("type `{}`", local_decl.ty)),
};

View file

@ -36,12 +36,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
let outlived_by = self.universal_region_relations.regions_outlived_by(region);
writeln!(
out,
"| {r:rw$} | {c:cw$} | {ob}",
r = format!("{:?}", region),
"| {r:rw$?} | {c:cw$?} | {ob:?}",
r = region,
rw = REGION_WIDTH,
c = format!("{:?}", classification),
c = classification,
cw = 8, // "External" at most
ob = format!("{:?}", outlived_by)
ob = outlived_by
)?;
}
}
@ -51,8 +51,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
for region in self.regions() {
writeln!(
out,
"| {r:rw$} | {ui:4?} | {v}",
r = format!("{:?}", region),
"| {r:rw$?} | {ui:4?} | {v}",
r = region,
rw = REGION_WIDTH,
ui = self.region_universe(region),
v = self.region_value_str(region),

View file

@ -550,7 +550,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
let span = infcx.tcx.def_span(*did);
if let Ok(snippet) = infcx.tcx.sess.source_map().span_to_snippet(span) {
let suggestable_fr_name = if fr_name.was_named() {
format!("{}", fr_name)
fr_name.to_string()
} else {
"'_".to_string()
};