Add manual_filter lint for Option
Share much of its implementation with `manual_map` and should greatly benefit from its previous feedback.
This commit is contained in:
parent
18e10ca290
commit
0958f9486b
13 changed files with 951 additions and 67 deletions
|
|
@ -1,7 +1,9 @@
|
|||
//! Contains utility functions to generate suggestions.
|
||||
#![deny(clippy::missing_docs_in_private_items)]
|
||||
|
||||
use crate::source::{snippet, snippet_opt, snippet_with_applicability, snippet_with_macro_callsite};
|
||||
use crate::source::{
|
||||
snippet, snippet_opt, snippet_with_applicability, snippet_with_context, snippet_with_macro_callsite,
|
||||
};
|
||||
use crate::ty::expr_sig;
|
||||
use crate::{get_parent_expr_for_hir, higher};
|
||||
use rustc_ast::util::parser::AssocOp;
|
||||
|
|
@ -110,7 +112,7 @@ impl<'a> Sugg<'a> {
|
|||
if expr.span.ctxt() == ctxt {
|
||||
Self::hir_from_snippet(expr, |span| snippet(cx, span, default))
|
||||
} else {
|
||||
let snip = snippet_with_applicability(cx, expr.span, default, applicability);
|
||||
let snip = snippet_with_context(cx, expr.span, ctxt, default, applicability).0;
|
||||
Sugg::NonParen(snip)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue