[−][src]Trait rustc_lint::unused::UnusedDelimLint
Used by both UnusedParens and UnusedBraces to prevent code duplication.
Associated Constants
pub(in unused) const DELIM_STR: &'static str[src]
pub(in unused) const LINT_EXPR_IN_PATTERN_MATCHING_CTX: bool[src]
Due to ref pattern, there can be a difference between using
{ expr } and expr in pattern-matching contexts. This means
that we should only lint unused_parens and not unused_braces
in this case.
let mut a = 7; let ref b = { a }; // We actually borrow a copy of `a` here. a += 1; // By mutating `a` we invalidate any borrows of `a`. assert_eq!(b + 1, a); // `b` does not borrow `a`, so we can still use it here.
Required methods
pub(in unused) fn lint(
&self
) -> &'static Lint[src]
&self
) -> &'static Lint
pub(in unused) fn check_unused_delims_expr(
&self,
cx: &EarlyContext<'_>,
value: &Expr,
ctx: UnusedDelimsCtx,
followed_by_block: bool,
left_pos: Option<BytePos>,
right_pos: Option<BytePos>
)[src]
&self,
cx: &EarlyContext<'_>,
value: &Expr,
ctx: UnusedDelimsCtx,
followed_by_block: bool,
left_pos: Option<BytePos>,
right_pos: Option<BytePos>
)
Provided methods
pub(in unused) fn is_expr_delims_necessary(
inner: &Expr,
followed_by_block: bool
) -> bool[src]
inner: &Expr,
followed_by_block: bool
) -> bool
pub(in unused) fn emit_unused_delims_expr(
&self,
cx: &EarlyContext<'_>,
value: &Expr,
ctx: UnusedDelimsCtx,
left_pos: Option<BytePos>,
right_pos: Option<BytePos>
)[src]
&self,
cx: &EarlyContext<'_>,
value: &Expr,
ctx: UnusedDelimsCtx,
left_pos: Option<BytePos>,
right_pos: Option<BytePos>
)
pub(in unused) fn emit_unused_delims(
&self,
cx: &EarlyContext<'_>,
span: Span,
pattern: &str,
msg: &str,
keep_space: (bool, bool)
)[src]
&self,
cx: &EarlyContext<'_>,
span: Span,
pattern: &str,
msg: &str,
keep_space: (bool, bool)
)
pub(in unused) fn check_expr(
&mut self,
cx: &EarlyContext<'_>,
e: &Expr
)[src]
&mut self,
cx: &EarlyContext<'_>,
e: &Expr
)
pub(in unused) fn check_stmt(
&mut self,
cx: &EarlyContext<'_>,
s: &Stmt
)[src]
&mut self,
cx: &EarlyContext<'_>,
s: &Stmt
)
pub(in unused) fn check_item(
&mut self,
cx: &EarlyContext<'_>,
item: &Item
)[src]
&mut self,
cx: &EarlyContext<'_>,
item: &Item
)
Implementors
impl UnusedDelimLint for UnusedBraces[src]
pub(in unused) const DELIM_STR: &'static str[src]
pub(in unused) const LINT_EXPR_IN_PATTERN_MATCHING_CTX: bool[src]
pub(in unused) fn lint(
&self
) -> &'static Lint[src]
&self
) -> &'static Lint
pub(in unused) fn check_unused_delims_expr(
&self,
cx: &EarlyContext<'_>,
value: &Expr,
ctx: UnusedDelimsCtx,
followed_by_block: bool,
left_pos: Option<BytePos>,
right_pos: Option<BytePos>
)[src]
&self,
cx: &EarlyContext<'_>,
value: &Expr,
ctx: UnusedDelimsCtx,
followed_by_block: bool,
left_pos: Option<BytePos>,
right_pos: Option<BytePos>
)
impl UnusedDelimLint for UnusedParens[src]
pub(in unused) const DELIM_STR: &'static str[src]
pub(in unused) const LINT_EXPR_IN_PATTERN_MATCHING_CTX: bool[src]
pub(in unused) fn lint(
&self
) -> &'static Lint[src]
&self
) -> &'static Lint
pub(in unused) fn check_unused_delims_expr(
&self,
cx: &EarlyContext<'_>,
value: &Expr,
ctx: UnusedDelimsCtx,
followed_by_block: bool,
left_pos: Option<BytePos>,
right_pos: Option<BytePos>
)[src]
&self,
cx: &EarlyContext<'_>,
value: &Expr,
ctx: UnusedDelimsCtx,
followed_by_block: bool,
left_pos: Option<BytePos>,
right_pos: Option<BytePos>
)