Suggest removing superfluous semicolon when statements used as expression#121153
Suggest removing superfluous semicolon when statements used as expression#121153bors merged 2 commits intorust-lang:masterfrom
Conversation
|
rustbot has assigned @michaelwoerister. Use r? to explicitly pick a reviewer |
| let node = self.tcx.hir_node(*hir_id); | ||
| let mut blocks = vec![]; | ||
| if let hir::Node::Block(block) = node | ||
| && let Some(expr) = block.expr |
There was a problem hiding this comment.
it seems hard to make it pure recursive, because I want to use self.tcx.parent_hir_node(..), and local function can not capture self.
|
r? diagnostics |
|
☔ The latest upstream changes (presumably #120576) made this pull request unmergeable. Please resolve the merge conflicts. |
0d1b0f8 to
29cb86c
Compare
| } | ||
| } | ||
|
|
||
| pub(super) fn suggest_for_statments_as_exp( |
There was a problem hiding this comment.
Could we rename this to suggest_turning_stmt_into_expr or something?
|
☔ The latest upstream changes (presumably #121489) made this pull request unmergeable. Please resolve the merge conflicts. |
29cb86c to
e2ce5d7
Compare
|
@rustbot r=estebank |
| }; | ||
| use rustc_hir_analysis::astconv::AstConv; | ||
| use rustc_infer::traits::{self, StatementAsExpression}; | ||
| use rustc_infer::traits::{self}; |
There was a problem hiding this comment.
| use rustc_infer::traits::{self}; | |
| use rustc_infer::traits; |
|
@bors r+ |
…iaskrgr Rollup of 11 pull requests Successful merges: - rust-lang#111505 (Made `INVALID_DOC_ATTRIBUTES` lint deny by default) - rust-lang#120305 (Delete line if suggestion would replace it with an empty line) - rust-lang#121153 (Suggest removing superfluous semicolon when statements used as expression) - rust-lang#121497 (`-Znext-solver=coherence`: suggest increasing recursion limit) - rust-lang#121634 (Clarify behavior of slice prefix/suffix operations in case of equality) - rust-lang#121706 (match lowering: Remove hacky branch in sort_candidate) - rust-lang#121730 (Add profiling support to AIX) - rust-lang#121750 (match lowering: Separate the `bool` case from other integers in `TestKind`) - rust-lang#121803 (Never say "`Trait` is implemented for `{type error}`") - rust-lang#121811 (Move sanitizer ui tests to sanitizer directory) - rust-lang#121824 (Implement missing ABI structures in StableMIR) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#121153 - chenyukang:yukang-fix-105431-type-mismatch, r=estebank Suggest removing superfluous semicolon when statements used as expression Fixes rust-lang#105431 - it's not a pure recursive visitor, so I guess there may be some more complex scenarios not covered. - moved `consider_removing_semicolon` to `compiler/rustc_infer` for reusing this helper function.
Fixes #105431
consider_removing_semicolontocompiler/rustc_inferfor reusing this helper function.