Skip to content

Commit 1e1efac

Browse files
committed
fix stuff
1 parent 7ac0c46 commit 1e1efac

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

clippy_lints/src/needless_move.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use rustc_lint::{LateContext, LateLintPass};
4242
use rustc_middle::mir::FakeReadCause;
4343
use rustc_middle::ty;
4444
use rustc_middle::ty::UpvarCapture;
45-
use rustc_session::{declare_lint_pass, declare_tool_lint};
45+
use rustc_session::declare_lint_pass;
4646

4747
declare_clippy_lint! {
4848
/// ### What it does
@@ -55,24 +55,25 @@ declare_clippy_lint! {
5555
/// the programmer adds the `move` keyword to move the variables into the closure, but
5656
/// then later decides that he no longer needs the variables in question, so he removes them
5757
/// from the body of the closure, but forgets to also remove the `move` keyword.
58-
///
58+
///
5959
/// This is really just a strict coding style issue.
60-
///
60+
///
6161
/// ### Caveats
6262
/// There are some cases where this lint will suggest removing the `move` keyword,
6363
/// but it would be considered idiomatic to keep it.
64-
///
64+
///
6565
/// For example, the closure passed to `std::thread::spawn` is usually always written
6666
/// with the `move` keyword, even if it's not necessary:
67-
///
67+
///
6868
/// ```no_run
69+
/// # fn function_that_does_something_with(_: String) {}
6970
/// let a = String::new();
7071
/// std::thread::spawn(move || {
7172
/// // ...
7273
/// function_that_does_something_with(a); // a is moved into the closure
7374
/// });
7475
/// ```
75-
///
76+
///
7677
/// ### Example
7778
/// ```no_run
7879
/// let a = String::new();
@@ -139,9 +140,7 @@ impl NeedlessMove {
139140
}
140141

141142
let note_msg = match lint_result {
142-
LintResult::NothingCaptured => {
143-
"there were no captured variables, so the `move` is unnecessary"
144-
},
143+
LintResult::NothingCaptured => "there were no captured variables, so the `move` is unnecessary",
145144
LintResult::Consumed => {
146145
"there were consumed variables, but no borrowed variables, so the `move` is unnecessary"
147146
},

0 commit comments

Comments
 (0)