add parentheses when unboxing suggestion needed#132944
Merged
bors merged 1 commit intorust-lang:masterfrom Nov 18, 2024
Merged
Conversation
Collaborator
|
r? @chenyukang rustbot has assigned @chenyukang. Use |
fmease
reviewed
Nov 12, 2024
| return None; | ||
| } | ||
|
|
||
| if checked_ty.is_box() && self.is_need_parenthesize(expr) { |
Member
There was a problem hiding this comment.
I presume due to the is_box(), the following code still leads to an invalid suggestion?
fn main() {
let x = std::rc::Rc::new(Some(1));
let test: Option<i32> = x as std::rc::Rc<Option<i32>>;
}I guess you can remove that box check?
Contributor
Author
There was a problem hiding this comment.
I guess you can remove that box check?
Thank you. Updated.
| false | ||
| } | ||
|
|
||
| fn is_need_parenthesize(&self, expr: &hir::Expr<'_>) -> bool { |
Member
There was a problem hiding this comment.
Suggested change
| fn is_need_parenthesize(&self, expr: &hir::Expr<'_>) -> bool { | |
| fn needs_parentheses(&self, expr: &hir::Expr<'_>) -> bool { |
53c5c5d to
949cf61
Compare
Member
|
@bors r+ rollup |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Nov 18, 2024
Rollup of 7 pull requests Successful merges: - rust-lang#132795 (Check `use<..>` in RPITIT for refinement) - rust-lang#132944 (add parentheses when unboxing suggestion needed) - rust-lang#132993 (Make rustc consider itself a stable compiler when `RUSTC_BOOTSTRAP=-1`) - rust-lang#133130 (`suggest_borrow_generic_arg`: instantiate clauses properly) - rust-lang#133133 (rustdoc-search: add standalone trailing `::` test) - rust-lang#133143 (Diagnostics for let mut in item context) - rust-lang#133147 (Fixup some test directives) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Nov 18, 2024
Rollup merge of rust-lang#132944 - linyihai:needing-parenthases-issue-132924, r=chenyukang add parentheses when unboxing suggestion needed This PR tried to `add parentheses when unboxing suggestion needed` Fixes rust-lang#132924
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR tried to
add parentheses when unboxing suggestion neededFixes #132924