about summary refs log tree commit diff
path: root/compiler/rustc_lint
diff options
context:
space:
mode:
authorDavid Wood <david.wood@huawei.com>2022-06-28 10:43:38 +0100
committerDavid Wood <david.wood@huawei.com>2022-06-30 08:59:22 +0100
commit4f7b10f484a42442c3e28bfbb62960460eba85f5 (patch)
tree53f7754fdf2b1c3cfb6a81ba73937ef6f5de3283 /compiler/rustc_lint
parente24833869f17b9032a1fbea69adfdd1e615918b9 (diff)
downloadrust-4f7b10f484a42442c3e28bfbb62960460eba85f5.tar.gz
rust-4f7b10f484a42442c3e28bfbb62960460eba85f5.zip
lint: port unused allocation diagnostics
Signed-off-by: David Wood <david.wood@huawei.com>
Diffstat (limited to 'compiler/rustc_lint')
-rw-r--r--compiler/rustc_lint/src/unused.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs
index 6fcabde3406..53269d18527 100644
--- a/compiler/rustc_lint/src/unused.rs
+++ b/compiler/rustc_lint/src/unused.rs
@@ -1169,15 +1169,13 @@ impl<'tcx> LateLintPass<'tcx> for UnusedAllocation {
         for adj in cx.typeck_results().expr_adjustments(e) {
             if let adjustment::Adjust::Borrow(adjustment::AutoBorrow::Ref(_, m)) = adj.kind {
                 cx.struct_span_lint(UNUSED_ALLOCATION, e.span, |lint| {
-                    let msg = match m {
-                        adjustment::AutoBorrowMutability::Not => {
-                            "unnecessary allocation, use `&` instead"
-                        }
+                    lint.build(match m {
+                        adjustment::AutoBorrowMutability::Not => fluent::lint::unused_allocation,
                         adjustment::AutoBorrowMutability::Mut { .. } => {
-                            "unnecessary allocation, use `&mut` instead"
+                            fluent::lint::unused_allocation_mut
                         }
-                    };
-                    lint.build(msg).emit();
+                    })
+                    .emit();
                 });
             }
         }