Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove special case for ExprKind::Paren in MutVisitor #87284

Merged
merged 1 commit into from
Jul 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions compiler/rustc_ast/src/mut_visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1347,12 +1347,6 @@ pub fn noop_visit_expr<T: MutVisitor>(
}
ExprKind::Paren(expr) => {
vis.visit_expr(expr);

// Nodes that are equal modulo `Paren` sugar no-ops should have the same IDs.
*id = expr.id;
vis.visit_span(span);
visit_thin_attrs(attrs, vis);
return;
}
ExprKind::Yield(expr) => {
visit_opt(expr, |expr| vis.visit_expr(expr));
Expand Down
9 changes: 9 additions & 0 deletions src/test/ui/lint/issue-87274-paren-parent.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// check-pass
// Tests that we properly lint at 'paren' expressions

fn foo() -> Result<(), String> {
(try!(Ok::<u8, String>(1))); //~ WARN use of deprecated macro `try`
Ok(())
}

fn main() {}
10 changes: 10 additions & 0 deletions src/test/ui/lint/issue-87274-paren-parent.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
warning: use of deprecated macro `try`: use the `?` operator instead
--> $DIR/issue-87274-paren-parent.rs:5:6
|
LL | (try!(Ok::<u8, String>(1)));
| ^^^
|
= note: `#[warn(deprecated)]` on by default

warning: 1 warning emitted