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

Rollup of 5 pull requests #94987

Merged
merged 12 commits into from
Mar 16, 2022
Merged

Rollup of 5 pull requests #94987

merged 12 commits into from
Mar 16, 2022

Conversation

Dylan-DPC
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

dtolnay and others added 12 commits March 11, 2022 15:26
Only look for complete suffixes or prefixes of irrefutable let patterns, so
that an irrefutable let pattern in a chain surrounded by refutable ones is
not linted, as it is an useful pattern.
Format core and std macro rules, removing needless surrounding blocks

Many of the asserting and printing macros in `core` and `std` are written with prehistoric-looking formatting, like this:

https://github.com/rust-lang/rust/blob/335ffbfa547df94ac236f5c56130cecf99c8d82b/library/std/src/macros.rs#L96-L101

In modern Rust style this would conventionally be written as follows instead, always using braces and a trailing semicolon on the macro arms:

https://github.com/rust-lang/rust/blob/af53809c874e0afb7be966df4d3cfcaa05277c53/library/std/src/macros.rs#L98-L105

Getting rid of the unneeded braces inside the expansion reduces extraneous indentation in macro-expanded code. For example:

```rust
println!("repro {}", true);
```

```rust
// before:

{
    ::std::io::_print(
        ::core::fmt::Arguments::new_v1(
            &["repro ", "\n"],
            &[::core::fmt::ArgumentV1::new_display(&true)],
        ),
    );
};
```

```rust
// after:

::std::io::_print(
    ::core::fmt::Arguments::new_v1(
        &["repro ", "\n"],
        &[::core::fmt::ArgumentV1::new_display(&true)],
    ),
);
```
…s, r=estebank

Extend the irrefutable_let_patterns lint to let chains

Implements the suggestion from rust-lang#94927 (comment)

We only look for complete suffixes or prefixes of irrefutable let patterns, so
that an irrefutable let pattern in a chain surrounded by refutable ones is
not linted, as it is an useful pattern that has no low-cost replacement (unlike suffixes or prefixes which can just be copied outside of the `if`: either into the `if`'s block, or the block surrounding the `if`).
If all patterns in a let chain are irrefutable, we lint as well.

Depends on rust-lang#94958 ~~so I included it into the PR for now~~ *which has been merged since*.

r? `@estebank`

cc `@joshtriplett` `@c410-f3r`
…rustc-parse, r=Dylan-DPC

Refactor: Use `format_args_capture` in some parts of `rustc_parse`
… r=Dylan-DPC

Improve the explanation about the behaviour of read_line

Close issue like rust-lang/book#2574
…et-else, r=joshtriplett

Ensure that `let_else` does not interact with `let_chains`

As requested on rust-lang#94927.

cc `@joshtriplett` `@estebank`
@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Mar 16, 2022
@Dylan-DPC
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Mar 16, 2022

📌 Commit aaf2255 has been approved by Dylan-DPC

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Mar 16, 2022
@bors
Copy link
Contributor

bors commented Mar 16, 2022

⌛ Testing commit aaf2255 with merge a2af9cf...

@bors
Copy link
Contributor

bors commented Mar 16, 2022

☀️ Test successful - checks-actions
Approved by: Dylan-DPC
Pushing a2af9cf to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 16, 2022
@bors bors merged commit a2af9cf into rust-lang:master Mar 16, 2022
@rustbot rustbot added this to the 1.61.0 milestone Mar 16, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a2af9cf): comparison url.

Summary: This benchmark run did not return any relevant results.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants