mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-18 00:53:31 +00:00
couple more notes
This commit is contained in:
parent
e68dbc3308
commit
a9da61b115
1 changed files with 4 additions and 0 deletions
|
@ -106,6 +106,8 @@ impl<'conf, 'cx> Visitor<'_> for NestingVisitor<'conf, 'cx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_block(&mut self, block: &Block) {
|
fn visit_block(&mut self, block: &Block) {
|
||||||
|
// TODO: Can we use some RAII guard instead? Borrow checker seems to hate that
|
||||||
|
// idea but it would be a lot cleaner.
|
||||||
self.nest_level += 1;
|
self.nest_level += 1;
|
||||||
|
|
||||||
if !check_indent(self, block.span) {
|
if !check_indent(self, block.span) {
|
||||||
|
@ -167,6 +169,8 @@ impl<'conf, 'cx> Visitor<'_> for NestingVisitor<'conf, 'cx> {
|
||||||
fn visit_expr(&mut self, expr: &Expr) {
|
fn visit_expr(&mut self, expr: &Expr) {
|
||||||
// This is a mess, but really all it does is extract every expression from every applicable variant
|
// This is a mess, but really all it does is extract every expression from every applicable variant
|
||||||
// of ExprKind until it finds a Block.
|
// of ExprKind until it finds a Block.
|
||||||
|
// TODO: clippy_utils has the two functions for_each_expr and for_each_expr_with_closures, can those
|
||||||
|
// be used here or are they not applicable for this case?
|
||||||
match &expr.kind {
|
match &expr.kind {
|
||||||
ExprKind::ConstBlock(anon_const) => self.visit_expr(&anon_const.value),
|
ExprKind::ConstBlock(anon_const) => self.visit_expr(&anon_const.value),
|
||||||
ExprKind::Call(.., args) => {
|
ExprKind::Call(.., args) => {
|
||||||
|
|
Loading…
Reference in a new issue