diff options
| author | hi-rustin <rustin.liu@gmail.com> | 2021-06-15 16:26:10 +0800 |
|---|---|---|
| committer | hi-rustin <rustin.liu@gmail.com> | 2021-06-15 16:26:10 +0800 |
| commit | 92d4164aca3647f08534a721bddec581a769a34a (patch) | |
| tree | 6832e6b5b8c976ddacb6f946b7444abc71140acd | |
| parent | 636d872452662c8cda7b9cb59db890943e25c281 (diff) | |
| download | rust-92d4164aca3647f08534a721bddec581a769a34a.tar.gz rust-92d4164aca3647f08534a721bddec581a769a34a.zip | |
better code
| -rw-r--r-- | compiler/rustc_middle/src/middle/stability.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_middle/src/middle/stability.rs b/compiler/rustc_middle/src/middle/stability.rs index 9d95b5bbb43..2804fe58061 100644 --- a/compiler/rustc_middle/src/middle/stability.rs +++ b/compiler/rustc_middle/src/middle/stability.rs @@ -233,12 +233,12 @@ fn late_report_deprecation( if span.in_derive_expansion() { return; } - - tcx.struct_span_lint_hir(lint, hir_id, method_span.unwrap_or(span), |lint| { + let method_span = method_span.unwrap_or(span); + tcx.struct_span_lint_hir(lint, hir_id, method_span, |lint| { let mut diag = lint.build(message); if let hir::Node::Expr(_) = tcx.hir().get(hir_id) { let kind = tcx.def_kind(def_id).descr(def_id); - deprecation_suggestion(&mut diag, kind, suggestion, method_span.unwrap_or(span)); + deprecation_suggestion(&mut diag, kind, suggestion, method_span); } diag.emit() }); |
