about summary refs log tree commit diff
diff options
context:
space:
mode:
authorhi-rustin <rustin.liu@gmail.com>2021-06-15 16:26:10 +0800
committerhi-rustin <rustin.liu@gmail.com>2021-06-15 16:26:10 +0800
commit92d4164aca3647f08534a721bddec581a769a34a (patch)
tree6832e6b5b8c976ddacb6f946b7444abc71140acd
parent636d872452662c8cda7b9cb59db890943e25c281 (diff)
downloadrust-92d4164aca3647f08534a721bddec581a769a34a.tar.gz
rust-92d4164aca3647f08534a721bddec581a769a34a.zip
better code
-rw-r--r--compiler/rustc_middle/src/middle/stability.rs6
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()
     });