diff options
| author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2021-02-22 16:55:20 +0300 |
|---|---|---|
| committer | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2021-02-22 16:55:20 +0300 |
| commit | c0c44360112e4574954c8016c59847a3f651bdaa (patch) | |
| tree | 69b2d2a240e5849437612f44179cd5eed59c922b /compiler | |
| parent | 8a9f7862bcfa5870a34bb54f77a03c73d1db5c37 (diff) | |
| download | rust-c0c44360112e4574954c8016c59847a3f651bdaa.tar.gz rust-c0c44360112e4574954c8016c59847a3f651bdaa.zip | |
Remove a redundant macro
Turn the macro into a function. Also remove unused 'span' argument.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_typeck/src/check/method/suggest.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/compiler/rustc_typeck/src/check/method/suggest.rs b/compiler/rustc_typeck/src/check/method/suggest.rs index 721e8ec54f0..e6c551ff4d4 100644 --- a/compiler/rustc_typeck/src/check/method/suggest.rs +++ b/compiler/rustc_typeck/src/check/method/suggest.rs @@ -517,21 +517,21 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } if self.is_fn_ty(&rcvr_ty, span) { - macro_rules! report_function { - ($span:expr, $name:expr) => { - err.note(&format!( - "`{}` is a function, perhaps you wish to call it", - $name - )); - }; + fn report_function<T: std::fmt::Display>( + err: &mut DiagnosticBuilder<'_>, + name: T, + ) { + err.note( + &format!("`{}` is a function, perhaps you wish to call it", name,), + ); } if let SelfSource::MethodCall(expr) = source { if let Ok(expr_string) = tcx.sess.source_map().span_to_snippet(expr.span) { - report_function!(expr.span, expr_string); + report_function(&mut err, expr_string); } else if let ExprKind::Path(QPath::Resolved(_, ref path)) = expr.kind { if let Some(segment) = path.segments.last() { - report_function!(expr.span, segment.ident); + report_function(&mut err, segment.ident); } } } |
