Skip to content

Commit a347955

Browse files
committed
apply suggested lint fixes
1 parent b3a7c05 commit a347955

File tree

2 files changed

+7
-18
lines changed

2 files changed

+7
-18
lines changed

clippy_lints/src/as_slice_instead_of_reference_full_range.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_utils::diagnostics::span_lint_and_sugg;
22
use clippy_utils::source::snippet_with_applicability;
33
use rustc_errors::Applicability;
4-
use rustc_hir::*;
4+
use rustc_hir::{Expr, ExprKind, LangItem, Mutability, QPath};
55
use rustc_lint::{LateContext, LateLintPass};
66
use rustc_session::declare_lint_pass;
77

@@ -38,29 +38,30 @@ impl LateLintPass<'_> for AsSliceInsteadOfReferenceFullRange {
3838
&& let ExprKind::Struct(qpath, _, _) = indexing.kind
3939
&& let QPath::LangItem(LangItem::RangeFull, _) = qpath
4040
{
41-
let snippet = snippet_with_applicability(cx, name.span, "..", &mut Applicability::Unspecified);
41+
let mut app = Applicability::MachineApplicable;
42+
let snippet = snippet_with_applicability(cx, name.span, "..", &mut app);
4243

4344
match mutability {
4445
Mutability::Not => {
4546
span_lint_and_sugg(
4647
cx,
4748
AS_SLICE_INSTEAD_OF_REFERENCE_FULL_RANGE,
4849
expr.span,
49-
format!("Use `.as_slice()` instead of full range slice"),
50+
"Use `.as_slice()` instead of full range slice",
5051
"try",
5152
format!("{snippet}.as_slice()"),
52-
Applicability::Unspecified,
53+
app,
5354
);
5455
},
5556
Mutability::Mut => {
5657
span_lint_and_sugg(
5758
cx,
5859
AS_SLICE_INSTEAD_OF_REFERENCE_FULL_RANGE,
5960
expr.span,
60-
format!("Use `.as_mut_slice()` instead of full range slice"),
61+
"Use `.as_mut_slice()` instead of full range slice",
6162
"try",
6263
format!("{snippet}.as_mut_slice()"),
63-
Applicability::Unspecified,
64+
app,
6465
);
6566
},
6667
}

tests/ui/array_as_slice_instead_of_unbounded_slice.stderr

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)