-
Couldn't load subscription status.
- Fork 13.9k
Rollup of 4 pull requests #134839
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
Rollup of 4 pull requests #134839
Conversation
Signed-off-by: chloefeal <[email protected]>
Co-authored-by: David Tolnay <[email protected]>
Fix typos This PR focuses on correcting typos and improving clarity in documentation files. Thank you.
Some random region tweaks Remove a redundant function and add an assertion that I think is useful
…r-errors
Skip parenthesis if `.` makes statement boundary unambiguous
There is a rule in the parser that statements and match-arms never end in front of a `.` or `?` token (except when the `.` is really `..` or `..=` or `...`). So some of the leading subexpressions that need parentheses inserted when followed by some other operator like `-` or `+`, do not need parentheses when followed by `.` or `?`.
Example:
```rust
fn main() {
loop {}.to_string() + "";
match () {
_ => loop {}.to_string() + "",
};
}
```
`-Zunpretty=expanded` before:
```console
#![feature(prelude_import)]
#[prelude_import]
use std::prelude::rust_2021::*;
#[macro_use]
extern crate std;
fn main() {
(loop {}).to_string() + "";
match () { _ => (loop {}).to_string() + "", };
}
```
After:
```console
#![feature(prelude_import)]
#[prelude_import]
use std::prelude::rust_2021::*;
#[macro_use]
extern crate std;
fn main() {
loop {}.to_string() + "";
match () { _ => loop {}.to_string() + "", };
}
```
…rors
Skip parenthesis around tuple struct field calls
The pretty-printer previously did not distinguish between named vs unnamed fields when printing a function call containing a struct field. It would print the call as `(self.fun)()` for a named field which is correct, and `(self.0)()` for an unnamed field which is redundant.
This PR changes function calls of tuple struct fields to print without parens.
**Before:**
```rust
struct Tuple(fn());
fn main() {
let tuple = Tuple(|| {});
(tuple.0)();
}
```
**After:**
```rust
struct Tuple(fn());
fn main() {
let tuple = Tuple(|| {});
tuple.0();
}
```
|
☀️ Test successful - checks-actions |
|
📌 Perf builds for each rolled up PR:
previous master: ecc189922d In the case of a perf regression, run the following command for each PR you suspect might be the cause: |
|
Finished benchmarking commit (2b0ceb8): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (secondary -0.2%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 761.661s -> 762.197s (0.07%) |
Rollup of 4 pull requests Successful merges: - rust-lang#134823 (Fix typos) - rust-lang#134827 (Some random region tweaks) - rust-lang#134833 (Skip parenthesis if `.` makes statement boundary unambiguous) - rust-lang#134834 (Skip parenthesis around tuple struct field calls) r? `@ghost` `@rustbot` modify labels: rollup
Successful merges:
.makes statement boundary unambiguous #134833 (Skip parenthesis if.makes statement boundary unambiguous)r? @ghost
@rustbot modify labels: rollup
Create a similar rollup