1
Fork 0

use &str / String literals instead of format!()

This commit is contained in:
Matthias Krüger 2022-12-18 16:17:46 +01:00
parent 35a99eef32
commit 3af7df91fc
19 changed files with 37 additions and 55 deletions

View file

@ -138,10 +138,10 @@ pub fn is_const_evaluatable<'tcx>(
} else if uv.has_non_region_param() {
NotConstEvaluatable::MentionsParam
} else {
let guar = infcx.tcx.sess.delay_span_bug(
span,
format!("Missing value for constant, but no error reported?"),
);
let guar = infcx
.tcx
.sess
.delay_span_bug(span, "Missing value for constant, but no error reported?");
NotConstEvaluatable::Error(guar)
};

View file

@ -2332,9 +2332,9 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
// get rid of :: between Trait and <type>
// must be '::' between them, otherwise the parser won't accept the code
suggestions.push((between_span, "".to_string(),));
suggestions.push((generic_arg.span_ext.shrink_to_hi(), format!(">")));
suggestions.push((generic_arg.span_ext.shrink_to_hi(), ">".to_string()));
} else {
suggestions.push((trait_path_segment.ident.span.shrink_to_hi(), format!(">")));
suggestions.push((trait_path_segment.ident.span.shrink_to_hi(), ">".to_string()));
}
err.multipart_suggestion(
message,

View file

@ -2740,7 +2740,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
}
ty::Closure(def_id, _) => err.span_note(
self.tcx.def_span(def_id),
&format!("required because it's used within this closure"),
"required because it's used within this closure",
),
_ => err.note(&msg),
};
@ -3386,7 +3386,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
}
err.span_note(
multi_span,
format!("the method call chain might not have had the expected associated types"),
"the method call chain might not have had the expected associated types",
);
}
}