Skip to content

Commit 8406229

Browse files
authored
Rollup merge of #82401 - osa1:remove_redundant_macro, r=matthewjasper
Remove a redundant macro Turn the macro into a function. Also remove unused 'span' argument.
2 parents ea43e5e + c0c4436 commit 8406229

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

compiler/rustc_typeck/src/check/method/suggest.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -517,21 +517,21 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
517517
}
518518

519519
if self.is_fn_ty(&rcvr_ty, span) {
520-
macro_rules! report_function {
521-
($span:expr, $name:expr) => {
522-
err.note(&format!(
523-
"`{}` is a function, perhaps you wish to call it",
524-
$name
525-
));
526-
};
520+
fn report_function<T: std::fmt::Display>(
521+
err: &mut DiagnosticBuilder<'_>,
522+
name: T,
523+
) {
524+
err.note(
525+
&format!("`{}` is a function, perhaps you wish to call it", name,),
526+
);
527527
}
528528

529529
if let SelfSource::MethodCall(expr) = source {
530530
if let Ok(expr_string) = tcx.sess.source_map().span_to_snippet(expr.span) {
531-
report_function!(expr.span, expr_string);
531+
report_function(&mut err, expr_string);
532532
} else if let ExprKind::Path(QPath::Resolved(_, ref path)) = expr.kind {
533533
if let Some(segment) = path.segments.last() {
534-
report_function!(expr.span, segment.ident);
534+
report_function(&mut err, segment.ident);
535535
}
536536
}
537537
}

0 commit comments

Comments
 (0)