Skip to content

Commit 1711368

Browse files
committed
Update lint name
1 parent 8910e57 commit 1711368

9 files changed

+13
-12
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3627,7 +3627,7 @@ Released 2018-09-13
36273627
[`cast_ref_to_mut`]: https://rust-lang.github.io/rust-clippy/master/index.html#cast_ref_to_mut
36283628
[`cast_sign_loss`]: https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
36293629
[`cast_slice_different_sizes`]: https://rust-lang.github.io/rust-clippy/master/index.html#cast_slice_different_sizes
3630-
[`cast_slice_reference_from_raw_parts`]: https://rust-lang.github.io/rust-clippy/master/index.html#cast_slice_reference_from_raw_parts
3630+
[`cast_slice_from_raw_parts`]: https://rust-lang.github.io/rust-clippy/master/index.html#cast_slice_from_raw_parts
36313631
[`char_lit_as_u8`]: https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8
36323632
[`chars_last_cmp`]: https://rust-lang.github.io/rust-clippy/master/index.html#chars_last_cmp
36333633
[`chars_next_cmp`]: https://rust-lang.github.io/rust-clippy/master/index.html#chars_next_cmp

clippy_lints/src/casts/cast_slice_reference_from_raw_parts.rs renamed to clippy_lints/src/casts/cast_slice_from_raw_parts.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_lint::LateContext;
88
use rustc_middle::ty::{self, Ty};
99
use rustc_semver::RustcVersion;
1010

11-
use super::CAST_SLICE_REFERENCE_FROM_RAW_PARTS;
11+
use super::CAST_SLICE_FROM_RAW_PARTS;
1212

1313
enum RawPartsKind {
1414
Immutable,
@@ -51,7 +51,7 @@ pub(super) fn check(
5151
let len = snippet_with_applicability(cx, len_arg.span, "len", &mut applicability);
5252
span_lint_and_sugg(
5353
cx,
54-
CAST_SLICE_REFERENCE_FROM_RAW_PARTS,
54+
CAST_SLICE_FROM_RAW_PARTS,
5555
span,
5656
&format!("casting the result of `{func}` to {cast_to}"),
5757
"replace with",

clippy_lints/src/casts/mod.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ mod cast_ptr_alignment;
1010
mod cast_ref_to_mut;
1111
mod cast_sign_loss;
1212
mod cast_slice_different_sizes;
13-
mod cast_slice_reference_from_raw_parts;
13+
mod cast_slice_from_raw_parts;
1414
mod char_lit_as_u8;
1515
mod fn_to_numeric_cast;
1616
mod fn_to_numeric_cast_any;
@@ -590,7 +590,7 @@ declare_clippy_lint! {
590590
/// ```
591591
/// [safety requirements]: https://doc.rust-lang.org/std/slice/fn.from_raw_parts.html#safety
592592
#[clippy::version = "1.64.0"]
593-
pub CAST_SLICE_REFERENCE_FROM_RAW_PARTS,
593+
pub CAST_SLICE_FROM_RAW_PARTS,
594594
suspicious,
595595
"casting a slice created from a pointer and length to a slice pointer"
596596
}
@@ -628,6 +628,7 @@ impl_lint_pass!(Casts => [
628628
BORROW_AS_PTR,
629629
RAW_SLICE_POINTER_CAST
630630
CAST_SLICE_REFERENCE_FROM_RAW_PARTS
631+
CAST_SLICE_FROM_RAW_PARTS
631632
]);
632633

633634
impl<'tcx> LateLintPass<'tcx> for Casts {
@@ -652,7 +653,7 @@ impl<'tcx> LateLintPass<'tcx> for Casts {
652653
if unnecessary_cast::check(cx, expr, cast_expr, cast_from, cast_to) {
653654
return;
654655
}
655-
cast_slice_reference_from_raw_parts::check(cx, expr, cast_expr, cast_to, self.msrv);
656+
cast_slice_from_raw_parts::check(cx, expr, cast_expr, cast_to, self.msrv);
656657
fn_to_numeric_cast_any::check(cx, expr, cast_expr, cast_from, cast_to);
657658
fn_to_numeric_cast::check(cx, expr, cast_expr, cast_from, cast_to);
658659
fn_to_numeric_cast_with_truncation::check(cx, expr, cast_expr, cast_from, cast_to);

clippy_lints/src/lib.register_all.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
2525
LintId::of(casts::CAST_ENUM_TRUNCATION),
2626
LintId::of(casts::CAST_REF_TO_MUT),
2727
LintId::of(casts::CAST_SLICE_DIFFERENT_SIZES),
28-
LintId::of(casts::CAST_SLICE_REFERENCE_FROM_RAW_PARTS),
28+
LintId::of(casts::CAST_SLICE_FROM_RAW_PARTS),
2929
LintId::of(casts::CHAR_LIT_AS_U8),
3030
LintId::of(casts::FN_TO_NUMERIC_CAST),
3131
LintId::of(casts::FN_TO_NUMERIC_CAST_WITH_TRUNCATION),

clippy_lints/src/lib.register_lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ store.register_lints(&[
7777
casts::CAST_REF_TO_MUT,
7878
casts::CAST_SIGN_LOSS,
7979
casts::CAST_SLICE_DIFFERENT_SIZES,
80-
casts::CAST_SLICE_REFERENCE_FROM_RAW_PARTS,
80+
casts::CAST_SLICE_FROM_RAW_PARTS,
8181
casts::CHAR_LIT_AS_U8,
8282
casts::FN_TO_NUMERIC_CAST,
8383
casts::FN_TO_NUMERIC_CAST_ANY,

clippy_lints/src/lib.register_suspicious.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ store.register_group(true, "clippy::suspicious", Some("clippy_suspicious"), vec!
1111
LintId::of(casts::CAST_ABS_TO_UNSIGNED),
1212
LintId::of(casts::CAST_ENUM_CONSTRUCTOR),
1313
LintId::of(casts::CAST_ENUM_TRUNCATION),
14-
LintId::of(casts::CAST_SLICE_REFERENCE_FROM_RAW_PARTS),
14+
LintId::of(casts::CAST_SLICE_FROM_RAW_PARTS),
1515
LintId::of(crate_in_macro_def::CRATE_IN_MACRO_DEF),
1616
LintId::of(drop_forget_ref::DROP_NON_DROP),
1717
LintId::of(drop_forget_ref::FORGET_NON_DROP),

tests/ui/cast_raw_slice_pointer_cast.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-rustfix
2-
#![warn(clippy::cast_slice_reference_from_raw_parts)]
2+
#![warn(clippy::cast_slice_from_raw_parts)]
33

44
#[allow(unused_imports, unused_unsafe)]
55
fn main() {

tests/ui/cast_raw_slice_pointer_cast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-rustfix
2-
#![warn(clippy::cast_slice_reference_from_raw_parts)]
2+
#![warn(clippy::cast_slice_from_raw_parts)]
33

44
#[allow(unused_imports, unused_unsafe)]
55
fn main() {

tests/ui/cast_raw_slice_pointer_cast.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: casting the result of `from_raw_parts` to *const [u8]
44
LL | let _: *const [u8] = unsafe { std::slice::from_raw_parts(ptr, 1) as *const [u8] };
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `core::ptr::slice_from_raw_parts(ptr, 1)`
66
|
7-
= note: `-D clippy::cast-slice-reference-from-raw-parts` implied by `-D warnings`
7+
= note: `-D clippy::cast-slice-from-raw-parts` implied by `-D warnings`
88

99
error: casting the result of `from_raw_parts_mut` to *mut [u8]
1010
--> $DIR/cast_raw_slice_pointer_cast.rs:10:35

0 commit comments

Comments
 (0)