diff options
| author | Jackson Lewis <jackson.lewis@agilebits.com> | 2021-05-14 17:07:30 -0700 |
|---|---|---|
| committer | Jackson Lewis <jackson.lewis@agilebits.com> | 2021-05-14 17:07:30 -0700 |
| commit | 1d8f3b51e662bb66e2b696d0c13057d6ba89f979 (patch) | |
| tree | 72260d7645d48c1612fce0ce9354501a445ca29c | |
| parent | c6e0e843d279c0c4703e2b3326826423b791dee2 (diff) | |
| download | rust-1d8f3b51e662bb66e2b696d0c13057d6ba89f979.tar.gz rust-1d8f3b51e662bb66e2b696d0c13057d6ba89f979.zip | |
Unnecessary -> Unused
| -rw-r--r-- | clippy_lints/src/lib.rs | 8 | ||||
| -rw-r--r-- | clippy_lints/src/unused_async.rs (renamed from clippy_lints/src/unnecessary_async.rs) | 10 | ||||
| -rw-r--r-- | tests/ui/unused_async.rs (renamed from tests/ui/unnecessary_async.rs) | 2 | ||||
| -rw-r--r-- | tests/ui/unused_async.stderr (renamed from tests/ui/unnecessary_async.stderr) | 6 |
4 files changed, 13 insertions, 13 deletions
diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index e8b8b2e9117..52e64d6a48f 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -360,7 +360,7 @@ mod unnamed_address; mod unnecessary_self_imports; mod unnecessary_sort_by; mod unnecessary_wraps; -mod unnecessary_async; +mod unused_async; mod unnested_or_patterns; mod unsafe_removed_from_name; mod unused_io_amount; @@ -955,7 +955,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: unit_types::UNIT_CMP, unnamed_address::FN_ADDRESS_COMPARISONS, unnamed_address::VTABLE_ADDRESS_COMPARISONS, - unnecessary_async::UNNECESSARY_ASYNC, + unused_async::UNUSED_ASYNC, unnecessary_self_imports::UNNECESSARY_SELF_IMPORTS, unnecessary_sort_by::UNNECESSARY_SORT_BY, unnecessary_wraps::UNNECESSARY_WRAPS, @@ -1273,7 +1273,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: store.register_late_pass(|| box manual_map::ManualMap); store.register_late_pass(move || box if_then_some_else_none::IfThenSomeElseNone::new(msrv)); store.register_early_pass(|| box bool_assert_comparison::BoolAssertComparison); - store.register_late_pass(|| box unnecessary_async::UnnecessaryAsync); + store.register_late_pass(|| box unused_async::UnusedAsync); store.register_group(true, "clippy::restriction", Some("clippy_restriction"), vec![ LintId::of(arithmetic::FLOAT_ARITHMETIC), @@ -1415,7 +1415,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf: LintId::of(unicode::NON_ASCII_LITERAL), LintId::of(unicode::UNICODE_NOT_NFC), LintId::of(unit_types::LET_UNIT_VALUE), - LintId::of(unnecessary_async::UNNECESSARY_ASYNC), + LintId::of(unused_async::UNUSED_ASYNC), LintId::of(unnecessary_wraps::UNNECESSARY_WRAPS), LintId::of(unnested_or_patterns::UNNESTED_OR_PATTERNS), LintId::of(unused_self::UNUSED_SELF), diff --git a/clippy_lints/src/unnecessary_async.rs b/clippy_lints/src/unused_async.rs index 15a90ba42d2..18ee07d3a95 100644 --- a/clippy_lints/src/unnecessary_async.rs +++ b/clippy_lints/src/unused_async.rs @@ -30,12 +30,12 @@ declare_clippy_lint! { /// } /// let number_future = async { get_random_number_improved() }; /// ``` - pub UNNECESSARY_ASYNC, + pub UNUSED_ASYNC, pedantic, "finds async functions with no await statements" } -declare_lint_pass!(UnnecessaryAsync => [UNNECESSARY_ASYNC]); +declare_lint_pass!(UnusedAsync => [UNUSED_ASYNC]); struct AsyncFnVisitor<'a, 'tcx> { cx: &'a LateContext<'tcx>, @@ -57,7 +57,7 @@ impl<'a, 'tcx> Visitor<'tcx> for AsyncFnVisitor<'a, 'tcx> { } } -impl<'tcx> LateLintPass<'tcx> for UnnecessaryAsync { +impl<'tcx> LateLintPass<'tcx> for UnusedAsync { fn check_item(&mut self, _: &LateContext<'tcx>, item: &'tcx Item<'tcx>) { if let ItemKind::Trait(..) = item.kind { return; @@ -79,9 +79,9 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryAsync { if !visitor.found_await { span_lint_and_help( cx, - UNNECESSARY_ASYNC, + UNUSED_ASYNC, span, - "unnecessary `async` for function with no await statements", + "unused `async` for function with no await statements", None, "consider removing the `async` from this function", ); diff --git a/tests/ui/unnecessary_async.rs b/tests/ui/unused_async.rs index 7d63083b13e..4f4203f5fdb 100644 --- a/tests/ui/unnecessary_async.rs +++ b/tests/ui/unused_async.rs @@ -1,5 +1,5 @@ // edition:2018 -#![warn(clippy::unnecessary_async)] +#![warn(clippy::unused_async)] async fn foo() -> i32 { 4 diff --git a/tests/ui/unnecessary_async.stderr b/tests/ui/unused_async.stderr index 5542580e45d..8b834d205b1 100644 --- a/tests/ui/unnecessary_async.stderr +++ b/tests/ui/unused_async.stderr @@ -1,12 +1,12 @@ -error: unnecessary `async` for function with no await statements - --> $DIR/unnecessary_async.rs:4:1 +error: unused `async` for function with no await statements + --> $DIR/unused_async.rs:4:1 | LL | / async fn foo() -> i32 { LL | | 4 LL | | } | |_^ | - = note: `-D clippy::unnecessary-async` implied by `-D warnings` + = note: `-D clippy::unused-async` implied by `-D warnings` = help: consider removing the `async` from this function error: aborting due to previous error |
