Avoid redundant to_string
This commit is contained in:
parent
a9528a28f2
commit
d57383855e
@ -288,8 +288,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
let mode = no_match_data.mode;
|
let mode = no_match_data.mode;
|
||||||
let tcx = self.tcx;
|
let tcx = self.tcx;
|
||||||
let rcvr_ty = self.resolve_vars_if_possible(rcvr_ty);
|
let rcvr_ty = self.resolve_vars_if_possible(rcvr_ty);
|
||||||
let (mut ty_str, ty_file) = tcx.short_ty_string(rcvr_ty);
|
let ((mut ty_str, ty_file), short_ty_str) = if trait_missing_method
|
||||||
let mut short_ty_str = with_forced_trimmed_paths!(rcvr_ty.to_string());
|
&& let ty::Dynamic(predicates, _, _) = rcvr_ty.kind() {
|
||||||
|
((predicates.to_string(), None), with_forced_trimmed_paths!(predicates.to_string()))
|
||||||
|
} else {
|
||||||
|
(tcx.short_ty_string(rcvr_ty), with_forced_trimmed_paths!(rcvr_ty.to_string()))
|
||||||
|
};
|
||||||
let is_method = mode == Mode::MethodCall;
|
let is_method = mode == Mode::MethodCall;
|
||||||
let unsatisfied_predicates = &no_match_data.unsatisfied_predicates;
|
let unsatisfied_predicates = &no_match_data.unsatisfied_predicates;
|
||||||
let similar_candidate = no_match_data.similar_candidate;
|
let similar_candidate = no_match_data.similar_candidate;
|
||||||
@ -328,11 +332,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
span = item_name.span;
|
span = item_name.span;
|
||||||
|
|
||||||
if trait_missing_method && let ty::Dynamic(predicates, _, _) = rcvr_ty.kind() {
|
|
||||||
ty_str = predicates.to_string();
|
|
||||||
short_ty_str = with_forced_trimmed_paths!(predicates.to_string());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't show generic arguments when the method can't be found in any implementation (#81576).
|
// Don't show generic arguments when the method can't be found in any implementation (#81576).
|
||||||
let mut ty_str_reported = ty_str.clone();
|
let mut ty_str_reported = ty_str.clone();
|
||||||
if let ty::Adt(_, generics) = rcvr_ty.kind() {
|
if let ty::Adt(_, generics) = rcvr_ty.kind() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user