Skip to content

Commit de269ec

Browse files
committed
remove wildcard import
1 parent a048e25 commit de269ec

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

clippy_lints/src/and_then_then_some.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use clippy_utils::source::snippet_with_applicability;
33
use clippy_utils::{fn_def_id, match_def_path};
44
use rustc_errors::Applicability;
55
use rustc_hir::def::Res;
6-
use rustc_hir::*;
6+
use rustc_hir::{Block, Closure, Expr, ExprKind, FnDecl, HirId, Node, Pat, Path, QPath, Ty};
77
use rustc_lint::{LateContext, LateLintPass};
88
use rustc_session::declare_lint_pass;
99
use rustc_span::Span;
@@ -19,12 +19,12 @@ declare_clippy_lint! {
1919
///
2020
/// ### Example
2121
/// ```no_run
22-
/// let x = Some("foo".to_string());
23-
/// let _y = x.clone().and_then(|v| v.starts_with('f').then_some(v));
22+
/// let x = Some("foo".to_string());
23+
/// let _y = x.clone().and_then(|v| v.starts_with('f').then_some(v));
2424
/// ```
2525
/// Use instead:
2626
/// ```no_run
27-
/// let x = Some("foo".to_string());
27+
/// let x = Some("foo".to_string());
2828
/// let _y = x.clone().filter(|v| v.starts_with('f'));
2929
/// ```
3030
#[clippy::version = "1.81.0"]
@@ -40,9 +40,7 @@ declare_lint_pass!(AndThenThenSome => [AND_THEN_THEN_SOME]);
4040
impl<'tcx> LateLintPass<'tcx> for AndThenThenSome {
4141
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
4242
match expr.kind {
43-
ExprKind::MethodCall(_, selfarg, [arg], _) |
44-
ExprKind::Call(_, [selfarg, arg])
45-
=> {
43+
ExprKind::MethodCall(_, selfarg, [arg], _) | ExprKind::Call(_, [selfarg, arg]) => {
4644
// TODO: check if type of reciever is diagnostic item Option?
4745
if is_and_then(cx, expr) {
4846
if let Some((closure_args, predicate)) = then_some_closure_arg(cx, arg) {
@@ -91,8 +89,7 @@ fn peel_closure_body<'tcx>(
9189
},
9290
_,
9391
) => peel_closure_body(cx, wrapped_expr, closure_arg_id),
94-
ExprKind::MethodCall(_, pred, [arg], _) |
95-
ExprKind::Call(_, [pred, arg]) => {
92+
ExprKind::MethodCall(_, pred, [arg], _) | ExprKind::Call(_, [pred, arg]) => {
9693
if is_then_some(cx, expr) && is_local_defined_at(cx, arg, closure_arg_id) {
9794
Some(pred)
9895
} else {

0 commit comments

Comments
 (0)