about summary refs log tree commit diff
diff options
context:
space:
mode:
authorwowinter13 <vla-dy@yandex.ru>2025-01-15 22:15:49 +0100
committerwowinter13 <vla-dy@yandex.ru>2025-01-25 18:43:07 +0100
commit26a7b322a37c1eeefb324bd3d082eeb36654c6a2 (patch)
tree4c239d7caea4d62827c6b9444f54a95fb1d226a0
parent9e83183f7ee7b7132f2bd6d857aee7bc2c7e46b3 (diff)
downloadrust-26a7b322a37c1eeefb324bd3d082eeb36654c6a2.tar.gz
rust-26a7b322a37c1eeefb324bd3d082eeb36654c6a2.zip
Rename slice_as_bytes -> sliced_string_as_bytes
-rw-r--r--CHANGELOG.md2
-rw-r--r--clippy_lints/src/declared_lints.rs2
-rw-r--r--clippy_lints/src/methods/mod.rs10
-rw-r--r--clippy_lints/src/methods/sliced_string_as_bytes.rs (renamed from clippy_lints/src/methods/slice_as_bytes.rs)4
-rw-r--r--tests/ui/bytes_nth.fixed2
-rw-r--r--tests/ui/bytes_nth.rs2
-rw-r--r--tests/ui/sliced_string_as_bytes.fixed (renamed from tests/ui/slice_as_bytes.fixed)2
-rw-r--r--tests/ui/sliced_string_as_bytes.rs (renamed from tests/ui/slice_as_bytes.rs)2
-rw-r--r--tests/ui/sliced_string_as_bytes.stderr (renamed from tests/ui/slice_as_bytes.stderr)8
9 files changed, 17 insertions, 17 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3a55c9f67ff..2757597fc51 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6066,7 +6066,7 @@ Released 2018-09-13
 [`size_of_in_element_count`]: https://rust-lang.github.io/rust-clippy/master/index.html#size_of_in_element_count
 [`size_of_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#size_of_ref
 [`skip_while_next`]: https://rust-lang.github.io/rust-clippy/master/index.html#skip_while_next
-[`slice_as_bytes`]: https://rust-lang.github.io/rust-clippy/master/index.html#slice_as_bytes
+[`sliced_string_as_bytes`]: https://rust-lang.github.io/rust-clippy/master/index.html#sliced_string_as_bytes
 [`slow_vector_initialization`]: https://rust-lang.github.io/rust-clippy/master/index.html#slow_vector_initialization
 [`stable_sort_primitive`]: https://rust-lang.github.io/rust-clippy/master/index.html#stable_sort_primitive
 [`std_instead_of_alloc`]: https://rust-lang.github.io/rust-clippy/master/index.html#std_instead_of_alloc
diff --git a/clippy_lints/src/declared_lints.rs b/clippy_lints/src/declared_lints.rs
index e822aedbd2c..ec223381aec 100644
--- a/clippy_lints/src/declared_lints.rs
+++ b/clippy_lints/src/declared_lints.rs
@@ -468,7 +468,7 @@ pub static LINTS: &[&crate::LintInfo] = &[
     crate::methods::SHOULD_IMPLEMENT_TRAIT_INFO,
     crate::methods::SINGLE_CHAR_ADD_STR_INFO,
     crate::methods::SKIP_WHILE_NEXT_INFO,
-    crate::methods::SLICE_AS_BYTES_INFO,
+    crate::methods::SLICED_STRING_AS_BYTES_INFO,
     crate::methods::STABLE_SORT_PRIMITIVE_INFO,
     crate::methods::STRING_EXTEND_CHARS_INFO,
     crate::methods::STRING_LIT_CHARS_ANY_INFO,
diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs
index 4a00da39a4b..3953fe03f31 100644
--- a/clippy_lints/src/methods/mod.rs
+++ b/clippy_lints/src/methods/mod.rs
@@ -102,7 +102,7 @@ mod single_char_add_str;
 mod single_char_insert_string;
 mod single_char_push_string;
 mod skip_while_next;
-mod slice_as_bytes;
+mod sliced_string_as_bytes;
 mod stable_sort_primitive;
 mod str_split;
 mod str_splitn;
@@ -4386,8 +4386,8 @@ declare_clippy_lint! {
     /// let s = "Lorem ipsum";
     /// &s.as_bytes()[1..5];
     /// ```
-     #[clippy::version = "1.72.0"]
-     pub SLICE_AS_BYTES,
+     #[clippy::version = "1.86.0"]
+     pub SLICED_STRING_AS_BYTES,
      pedantic,
      "slicing a string and immediately calling as_bytes is less efficient and can lead to panics"
 }
@@ -4560,7 +4560,7 @@ impl_lint_pass!(Methods => [
     DOUBLE_ENDED_ITERATOR_LAST,
     USELESS_NONZERO_NEW_UNCHECKED,
     MANUAL_REPEAT_N,
-    SLICE_AS_BYTES,
+    SLICED_STRING_AS_BYTES,
 ]);
 
 /// Extracts a method call name, args, and `Span` of the method name.
@@ -4828,7 +4828,7 @@ impl Methods {
                     if let Some(("as_str", recv, [], as_str_span, _)) = method_call(recv) {
                         redundant_as_str::check(cx, expr, recv, as_str_span, span);
                     }
-                    slice_as_bytes::check(cx, expr, recv);
+                    sliced_string_as_bytes::check(cx, expr, recv);
                 },
                 ("as_mut", []) => useless_asref::check(cx, expr, "as_mut", recv),
                 ("as_ptr", []) => manual_c_str_literals::check_as_ptr(cx, expr, recv, &self.msrv),
diff --git a/clippy_lints/src/methods/slice_as_bytes.rs b/clippy_lints/src/methods/sliced_string_as_bytes.rs
index 4040008c98a..43aab8a452e 100644
--- a/clippy_lints/src/methods/slice_as_bytes.rs
+++ b/clippy_lints/src/methods/sliced_string_as_bytes.rs
@@ -5,7 +5,7 @@ use rustc_errors::Applicability;
 use rustc_hir::{Expr, ExprKind, LangItem, is_range_literal};
 use rustc_lint::LateContext;
 
-use super::SLICE_AS_BYTES;
+use super::SLICED_STRING_AS_BYTES;
 
 pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>) {
     if let ExprKind::Index(indexed, index, _) = recv.kind
@@ -18,7 +18,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>) {
             let range = snippet_with_applicability(cx, index.span, "..", &mut applicability);
             span_lint_and_sugg(
                 cx,
-                SLICE_AS_BYTES,
+                SLICED_STRING_AS_BYTES,
                 expr.span,
                 "calling `as_bytes` after slicing a string",
                 "try",
diff --git a/tests/ui/bytes_nth.fixed b/tests/ui/bytes_nth.fixed
index d58eb5227fb..da35fcb55e5 100644
--- a/tests/ui/bytes_nth.fixed
+++ b/tests/ui/bytes_nth.fixed
@@ -1,5 +1,5 @@
 #![allow(clippy::unnecessary_operation)]
-#![allow(clippy::slice_as_bytes)]
+#![allow(clippy::sliced_string_as_bytes)]
 #![warn(clippy::bytes_nth)]
 
 fn main() {
diff --git a/tests/ui/bytes_nth.rs b/tests/ui/bytes_nth.rs
index bbfe388e8bb..5dbe84ecec8 100644
--- a/tests/ui/bytes_nth.rs
+++ b/tests/ui/bytes_nth.rs
@@ -1,5 +1,5 @@
 #![allow(clippy::unnecessary_operation)]
-#![allow(clippy::slice_as_bytes)]
+#![allow(clippy::sliced_string_as_bytes)]
 #![warn(clippy::bytes_nth)]
 
 fn main() {
diff --git a/tests/ui/slice_as_bytes.fixed b/tests/ui/sliced_string_as_bytes.fixed
index da627717a52..469ad27a99b 100644
--- a/tests/ui/slice_as_bytes.fixed
+++ b/tests/ui/sliced_string_as_bytes.fixed
@@ -1,5 +1,5 @@
 #![allow(unused)]
-#![warn(clippy::slice_as_bytes)]
+#![warn(clippy::sliced_string_as_bytes)]
 
 use std::ops::{Index, Range};
 
diff --git a/tests/ui/slice_as_bytes.rs b/tests/ui/sliced_string_as_bytes.rs
index 095b7773810..4a4605e5a1a 100644
--- a/tests/ui/slice_as_bytes.rs
+++ b/tests/ui/sliced_string_as_bytes.rs
@@ -1,5 +1,5 @@
 #![allow(unused)]
-#![warn(clippy::slice_as_bytes)]
+#![warn(clippy::sliced_string_as_bytes)]
 
 use std::ops::{Index, Range};
 
diff --git a/tests/ui/slice_as_bytes.stderr b/tests/ui/sliced_string_as_bytes.stderr
index 9a787b0b917..47c928d1c1e 100644
--- a/tests/ui/slice_as_bytes.stderr
+++ b/tests/ui/sliced_string_as_bytes.stderr
@@ -1,20 +1,20 @@
 error: calling `as_bytes` after slicing a string
-  --> tests/ui/slice_as_bytes.rs:28:17
+  --> tests/ui/sliced_string_as_bytes.rs:28:17
    |
 LL |     let bytes = s[1..5].as_bytes();
    |                 ^^^^^^^^^^^^^^^^^^ help: try: `&s.as_bytes()[1..5]`
    |
    = note: `-D clippy::slice-as-bytes` implied by `-D warnings`
-   = help: to override `-D warnings` add `#[allow(clippy::slice_as_bytes)]`
+   = help: to override `-D warnings` add `#[allow(clippy::sliced_string_as_bytes)]`
 
 error: calling `as_bytes` after slicing a string
-  --> tests/ui/slice_as_bytes.rs:29:17
+  --> tests/ui/sliced_string_as_bytes.rs:29:17
    |
 LL |     let bytes = string[1..].as_bytes();
    |                 ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&string.as_bytes()[1..]`
 
 error: calling `as_bytes` after slicing a string
-  --> tests/ui/slice_as_bytes.rs:30:17
+  --> tests/ui/sliced_string_as_bytes.rs:30:17
    |
 LL |     let bytes = "consectetur adipiscing"[..=5].as_bytes();
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&"consectetur adipiscing".as_bytes()[..=5]`