Skip to content

Commit 014b0e7

Browse files
committed
Rename slice_as_deref to deref_as_slicing
1 parent ac282d8 commit 014b0e7

8 files changed

+15
-15
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2932,6 +2932,7 @@ Released 2018-09-13
29322932
[`deprecated_cfg_attr`]: https://rust-lang.github.io/rust-clippy/master/index.html#deprecated_cfg_attr
29332933
[`deprecated_semver`]: https://rust-lang.github.io/rust-clippy/master/index.html#deprecated_semver
29342934
[`deref_addrof`]: https://rust-lang.github.io/rust-clippy/master/index.html#deref_addrof
2935+
[`deref_by_slicing`]: https://rust-lang.github.io/rust-clippy/master/index.html#deref_by_slicing
29352936
[`derivable_impls`]: https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
29362937
[`derive_hash_xor_eq`]: https://rust-lang.github.io/rust-clippy/master/index.html#derive_hash_xor_eq
29372938
[`derive_ord_xor_partial_ord`]: https://rust-lang.github.io/rust-clippy/master/index.html#derive_ord_xor_partial_ord
@@ -3260,7 +3261,6 @@ Released 2018-09-13
32603261
[`single_match_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#single_match_else
32613262
[`size_of_in_element_count`]: https://rust-lang.github.io/rust-clippy/master/index.html#size_of_in_element_count
32623263
[`skip_while_next`]: https://rust-lang.github.io/rust-clippy/master/index.html#skip_while_next
3263-
[`slice_as_deref`]: https://rust-lang.github.io/rust-clippy/master/index.html#slice_as_deref
32643264
[`slow_vector_initialization`]: https://rust-lang.github.io/rust-clippy/master/index.html#slow_vector_initialization
32653265
[`stable_sort_primitive`]: https://rust-lang.github.io/rust-clippy/master/index.html#stable_sort_primitive
32663266
[`str_to_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#str_to_string

clippy_lints/src/lib.register_lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,8 @@ store.register_lints(&[
416416
redundant_else::REDUNDANT_ELSE,
417417
redundant_field_names::REDUNDANT_FIELD_NAMES,
418418
redundant_pub_crate::REDUNDANT_PUB_CRATE,
419+
redundant_slicing::DEREF_BY_SLICING,
419420
redundant_slicing::REDUNDANT_SLICING,
420-
redundant_slicing::SLICE_AS_DEREF,
421421
redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES,
422422
ref_option_ref::REF_OPTION_REF,
423423
reference::DEREF_ADDROF,

clippy_lints/src/lib.register_restriction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ store.register_group(true, "clippy::restriction", Some("clippy_restriction"), ve
5050
LintId::of(panic_unimplemented::UNIMPLEMENTED),
5151
LintId::of(panic_unimplemented::UNREACHABLE),
5252
LintId::of(pattern_type_mismatch::PATTERN_TYPE_MISMATCH),
53-
LintId::of(redundant_slicing::SLICE_AS_DEREF),
53+
LintId::of(redundant_slicing::DEREF_BY_SLICING),
5454
LintId::of(same_name_method::SAME_NAME_METHOD),
5555
LintId::of(shadow::SHADOW_REUSE),
5656
LintId::of(shadow::SHADOW_SAME),

clippy_lints/src/redundant_slicing.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ declare_clippy_lint! {
6161
/// let slice = &*vec;
6262
/// ```
6363
#[clippy::version = "1.59.0"]
64-
pub SLICE_AS_DEREF,
64+
pub DEREF_BY_SLICING,
6565
restriction,
6666
"slicing instead of dereferencing"
6767
}
6868

69-
declare_lint_pass!(RedundantSlicing => [REDUNDANT_SLICING, SLICE_AS_DEREF]);
69+
declare_lint_pass!(RedundantSlicing => [REDUNDANT_SLICING, DEREF_BY_SLICING]);
7070

7171
impl LateLintPass<'_> for RedundantSlicing {
7272
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
@@ -140,7 +140,7 @@ impl LateLintPass<'_> for RedundantSlicing {
140140
} else {
141141
format!("&{}{}*{}", mutability.prefix_str(), "*".repeat(indexed_ref_count), snip)
142142
};
143-
(SLICE_AS_DEREF, "slicing when dereferencing would work", "dereference the original value instead", sugg)
143+
(DEREF_BY_SLICING, "slicing when dereferencing would work", "dereference the original value instead", sugg)
144144
} else {
145145
return;
146146
}

tests/ui/slice_as_deref.fixed renamed to tests/ui/deref_by_slicing.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// run-rustfix
22

3-
#![warn(clippy::slice_as_deref)]
3+
#![warn(clippy::deref_by_slicing)]
44

55
fn main() {
66
let mut vec = vec![0];

tests/ui/slice_as_deref.rs renamed to tests/ui/deref_by_slicing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// run-rustfix
22

3-
#![warn(clippy::slice_as_deref)]
3+
#![warn(clippy::deref_by_slicing)]
44

55
fn main() {
66
let mut vec = vec![0];

tests/ui/slice_as_deref.stderr renamed to tests/ui/deref_by_slicing.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
error: slicing when dereferencing would work
2-
--> $DIR/slice_as_deref.rs:7:13
2+
--> $DIR/deref_by_slicing.rs:7:13
33
|
44
LL | let _ = &vec[..];
55
| ^^^^^^^^ help: dereference the original value instead: `&*vec`
66
|
7-
= note: `-D clippy::slice-as-deref` implied by `-D warnings`
7+
= note: `-D clippy::deref-by-slicing` implied by `-D warnings`
88

99
error: slicing when dereferencing would work
10-
--> $DIR/slice_as_deref.rs:8:13
10+
--> $DIR/deref_by_slicing.rs:8:13
1111
|
1212
LL | let _ = &mut vec[..];
1313
| ^^^^^^^^^^^^ help: dereference the original value instead: `&mut *vec`
1414

1515
error: slicing when dereferencing would work
16-
--> $DIR/slice_as_deref.rs:11:13
16+
--> $DIR/deref_by_slicing.rs:11:13
1717
|
1818
LL | let _ = &ref_vec[..];
1919
| ^^^^^^^^^^^^ help: dereference the original value instead: `&**ref_vec`
2020

2121
error: slicing when dereferencing would work
22-
--> $DIR/slice_as_deref.rs:12:13
22+
--> $DIR/deref_by_slicing.rs:12:13
2323
|
2424
LL | let _ = &mut ref_vec[..];
2525
| ^^^^^^^^^^^^^^^^ help: dereference the original value instead: `&mut **ref_vec`
2626

2727
error: slicing when dereferencing would work
28-
--> $DIR/slice_as_deref.rs:15:13
28+
--> $DIR/deref_by_slicing.rs:15:13
2929
|
3030
LL | let _ = &s[..];
3131
| ^^^^^^ help: dereference the original value instead: `&*s`

tests/ui/redundant_slicing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// run-rustfix
22

3-
#![allow(unused, clippy::slice_as_deref)]
3+
#![allow(unused, clippy::deref_by_slicing)]
44
#![warn(clippy::redundant_slicing)]
55

66
use std::io::Read;

0 commit comments

Comments
 (0)