diff options
| author | Doru-Florin Blanzeanu <blanzeanu.doru@protonmail.com> | 2022-10-24 15:54:08 +0000 |
|---|---|---|
| committer | Doru-Florin Blanzeanu <blanzeanu.doru@protonmail.com> | 2022-10-24 16:31:45 +0000 |
| commit | b9b9d6a751ca3a9ccdd64f50390361e339f5124f (patch) | |
| tree | 8f94e33ff5e8b1dca2f7c904c34e4539ab349bd1 | |
| parent | b48a4668f4767412b3d9797ce3d6ee63f351caee (diff) | |
| download | rust-b9b9d6a751ca3a9ccdd64f50390361e339f5124f.tar.gz rust-b9b9d6a751ca3a9ccdd64f50390361e339f5124f.zip | |
Change lint name to `seek_to_start_instead_of_rewind`
- This name makes more sense and highlights the issue Signed-off-by: Doru-Florin Blanzeanu <blanzeanu.doru@protonmail.com>
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | clippy_lints/src/declared_lints.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/methods/mod.rs | 8 | ||||
| -rw-r--r-- | clippy_lints/src/methods/seek_to_start_instead_of_rewind.rs (renamed from clippy_lints/src/methods/rewind_instead_of_seek_to_start.rs) | 4 | ||||
| -rw-r--r-- | src/docs/seek_to_start_instead_of_rewind.txt (renamed from src/docs/rewind_instead_of_seek_to_start.txt) | 0 | ||||
| -rw-r--r-- | tests/ui/seek_to_start_instead_of_rewind.fixed (renamed from tests/ui/rewind_instead_of_seek_to_start.fixed) | 2 | ||||
| -rw-r--r-- | tests/ui/seek_to_start_instead_of_rewind.rs (renamed from tests/ui/rewind_instead_of_seek_to_start.rs) | 2 | ||||
| -rw-r--r-- | tests/ui/seek_to_start_instead_of_rewind.stderr (renamed from tests/ui/rewind_instead_of_seek_to_start.stderr) | 8 |
8 files changed, 14 insertions, 14 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 09f914fe0ca..ae9fc46a42f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4195,11 +4195,11 @@ Released 2018-09-13 [`result_unwrap_used`]: https://rust-lang.github.io/rust-clippy/master/index.html#result_unwrap_used [`return_self_not_must_use`]: https://rust-lang.github.io/rust-clippy/master/index.html#return_self_not_must_use [`reversed_empty_ranges`]: https://rust-lang.github.io/rust-clippy/master/index.html#reversed_empty_ranges -[`rewind_instead_of_seek_to_start`]: https://rust-lang.github.io/rust-clippy/master/index.html#rewind_instead_of_seek_to_start [`same_functions_in_if_condition`]: https://rust-lang.github.io/rust-clippy/master/index.html#same_functions_in_if_condition [`same_item_push`]: https://rust-lang.github.io/rust-clippy/master/index.html#same_item_push [`same_name_method`]: https://rust-lang.github.io/rust-clippy/master/index.html#same_name_method [`search_is_some`]: https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some +[`seek_to_start_instead_of_rewind`]: https://rust-lang.github.io/rust-clippy/master/index.html#seek_to_start_instead_of_rewind [`self_assignment`]: https://rust-lang.github.io/rust-clippy/master/index.html#self_assignment [`self_named_constructors`]: https://rust-lang.github.io/rust-clippy/master/index.html#self_named_constructors [`self_named_module_files`]: https://rust-lang.github.io/rust-clippy/master/index.html#self_named_module_files diff --git a/clippy_lints/src/declared_lints.rs b/clippy_lints/src/declared_lints.rs index ad482cfc2e7..5d963bb5488 100644 --- a/clippy_lints/src/declared_lints.rs +++ b/clippy_lints/src/declared_lints.rs @@ -361,8 +361,8 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[ crate::methods::RANGE_ZIP_WITH_LEN_INFO, crate::methods::REPEAT_ONCE_INFO, crate::methods::RESULT_MAP_OR_INTO_OPTION_INFO, - crate::methods::REWIND_INSTEAD_OF_SEEK_TO_START_INFO, crate::methods::SEARCH_IS_SOME_INFO, + crate::methods::SEEK_TO_START_INSTEAD_OF_REWIND_INFO, crate::methods::SHOULD_IMPLEMENT_TRAIT_INFO, crate::methods::SINGLE_CHAR_ADD_STR_INFO, crate::methods::SINGLE_CHAR_PATTERN_INFO, diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index 7b0a676e89e..4fd1e3e54ae 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -68,8 +68,8 @@ mod or_then_unwrap; mod path_buf_push_overwrite; mod range_zip_with_len; mod repeat_once; -mod rewind_instead_of_seek_to_start; mod search_is_some; +mod seek_to_start_instead_of_rewind; mod single_char_add_str; mod single_char_insert_string; mod single_char_pattern; @@ -3093,7 +3093,7 @@ declare_clippy_lint! { /// } /// ``` #[clippy::version = "1.66.0"] - pub REWIND_INSTEAD_OF_SEEK_TO_START, + pub SEEK_TO_START_INSTEAD_OF_REWIND, complexity, "jumping to the start of stream using `seek` method" } @@ -3222,7 +3222,7 @@ impl_lint_pass!(Methods => [ VEC_RESIZE_TO_ZERO, VERBOSE_FILE_READS, ITER_KV_MAP, - REWIND_INSTEAD_OF_SEEK_TO_START, + SEEK_TO_START_INSTEAD_OF_REWIND, ]); /// Extracts a method call name, args, and `Span` of the method name. @@ -3639,7 +3639,7 @@ impl Methods { }, ("seek", [arg]) => { if meets_msrv(self.msrv, msrvs::SEEK_REWIND) { - rewind_instead_of_seek_to_start::check(cx, expr, recv, arg, span); + seek_to_start_instead_of_rewind::check(cx, expr, recv, arg, span); } }, ("sort", []) => { diff --git a/clippy_lints/src/methods/rewind_instead_of_seek_to_start.rs b/clippy_lints/src/methods/seek_to_start_instead_of_rewind.rs index 97b33dec843..7e3bed1e41a 100644 --- a/clippy_lints/src/methods/rewind_instead_of_seek_to_start.rs +++ b/clippy_lints/src/methods/seek_to_start_instead_of_rewind.rs @@ -7,7 +7,7 @@ use rustc_hir::{Expr, ExprKind}; use rustc_lint::LateContext; use rustc_span::Span; -use super::REWIND_INSTEAD_OF_SEEK_TO_START; +use super::SEEK_TO_START_INSTEAD_OF_REWIND; pub(super) fn check<'tcx>( cx: &LateContext<'tcx>, @@ -32,7 +32,7 @@ pub(super) fn check<'tcx>( let method_call_span = expr.span.with_lo(name_span.lo()); span_lint_and_then( cx, - REWIND_INSTEAD_OF_SEEK_TO_START, + SEEK_TO_START_INSTEAD_OF_REWIND, method_call_span, "used `seek` to go to the start of the stream", |diag| { diff --git a/src/docs/rewind_instead_of_seek_to_start.txt b/src/docs/seek_to_start_instead_of_rewind.txt index bef11b2312a..bef11b2312a 100644 --- a/src/docs/rewind_instead_of_seek_to_start.txt +++ b/src/docs/seek_to_start_instead_of_rewind.txt diff --git a/tests/ui/rewind_instead_of_seek_to_start.fixed b/tests/ui/seek_to_start_instead_of_rewind.fixed index 36853780977..464b6cdef63 100644 --- a/tests/ui/rewind_instead_of_seek_to_start.fixed +++ b/tests/ui/seek_to_start_instead_of_rewind.fixed @@ -1,7 +1,7 @@ // run-rustfix #![allow(unused)] #![feature(custom_inner_attributes)] -#![warn(clippy::rewind_instead_of_seek_to_start)] +#![warn(clippy::seek_to_start_instead_of_rewind)] use std::fs::OpenOptions; use std::io::{Read, Seek, SeekFrom, Write}; diff --git a/tests/ui/rewind_instead_of_seek_to_start.rs b/tests/ui/seek_to_start_instead_of_rewind.rs index 0d061b58fba..68e09bd7c1f 100644 --- a/tests/ui/rewind_instead_of_seek_to_start.rs +++ b/tests/ui/seek_to_start_instead_of_rewind.rs @@ -1,7 +1,7 @@ // run-rustfix #![allow(unused)] #![feature(custom_inner_attributes)] -#![warn(clippy::rewind_instead_of_seek_to_start)] +#![warn(clippy::seek_to_start_instead_of_rewind)] use std::fs::OpenOptions; use std::io::{Read, Seek, SeekFrom, Write}; diff --git a/tests/ui/rewind_instead_of_seek_to_start.stderr b/tests/ui/seek_to_start_instead_of_rewind.stderr index e8086781084..de0eec5d909 100644 --- a/tests/ui/rewind_instead_of_seek_to_start.stderr +++ b/tests/ui/seek_to_start_instead_of_rewind.stderr @@ -1,19 +1,19 @@ error: used `seek` to go to the start of the stream - --> $DIR/rewind_instead_of_seek_to_start.rs:54:7 + --> $DIR/seek_to_start_instead_of_rewind.rs:54:7 | LL | t.seek(SeekFrom::Start(0)); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `rewind()` | - = note: `-D clippy::rewind-instead-of-seek-to-start` implied by `-D warnings` + = note: `-D clippy::seek-to-start-instead-of-rewind` implied by `-D warnings` error: used `seek` to go to the start of the stream - --> $DIR/rewind_instead_of_seek_to_start.rs:59:7 + --> $DIR/seek_to_start_instead_of_rewind.rs:59:7 | LL | t.seek(SeekFrom::Start(0)); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `rewind()` error: used `seek` to go to the start of the stream - --> $DIR/rewind_instead_of_seek_to_start.rs:131:7 + --> $DIR/seek_to_start_instead_of_rewind.rs:131:7 | LL | f.seek(SeekFrom::Start(0)); | ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `rewind()` |
