Skip to content

Commit 3242d01

Browse files
committed
fixed bug
1 parent e383b6f commit 3242d01

File tree

1 file changed

+10
-13
lines changed
  • compiler/rustc_hir_typeck/src/fn_ctxt

1 file changed

+10
-13
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

+10-13
Original file line numberDiff line numberDiff line change
@@ -1549,20 +1549,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
15491549
if let Some(suggestion_text) = suggestion_text {
15501550
let source_map = self.sess().source_map();
15511551
let (mut suggestion, suggestion_span) = if let Some(call_span) =
1552-
full_call_span.find_ancestor_inside_same_ctxt(error_span)
1553-
{
1554-
("(".to_string(), call_span.shrink_to_hi().to(error_span.shrink_to_hi()))
1555-
} else {
1556-
let snippet = source_map.span_to_snippet(full_call_span).unwrap_or_default();
1557-
let method_name = if snippet.contains("::") {
1558-
snippet.rsplit("::").next().unwrap_or(&snippet).to_string()
1552+
full_call_span.find_ancestor_inside_same_ctxt(error_span)
1553+
{
1554+
("(".to_string(), call_span.shrink_to_hi().to(error_span.shrink_to_hi()))
15591555
} else {
1560-
snippet
1561-
};
1562-
(
1563-
format!("{}(", method_name),
1564-
error_span,
1565-
)
1556+
let snippet = source_map.span_to_snippet(full_call_span).unwrap_or_default();
1557+
let method_name = if snippet.contains("::") {
1558+
snippet.rsplit("::").next().unwrap_or(&snippet).to_string()
1559+
} else {
1560+
snippet
1561+
};
1562+
(format!("{}(", method_name), error_span)
15661563
};
15671564
let mut needs_comma = false;
15681565
for (expected_idx, provided_idx) in matched_inputs.iter_enumerated() {

0 commit comments

Comments
 (0)