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

Use context instead of with_context #14377

Merged
merged 5 commits into from
Aug 9, 2024
Merged

Use context instead of with_context #14377

merged 5 commits into from
Aug 9, 2024

Conversation

mo8it
Copy link
Contributor

@mo8it mo8it commented Aug 9, 2024

Replace .with_context(|| "…") with .context("…") to avoid calling a trivial closure. It is also shorter :)

On the other hand, use .with_context(|| format!(…)) instead of .context(format!(…)) to avoid unneeded string allocation.

@rustbot
Copy link
Collaborator

rustbot commented Aug 9, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @weihanglo (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@rustbot rustbot added A-build-execution Area: anything dealing with executing the compiler A-build-scripts Area: build.rs scripts A-configuration Area: cargo config files and env vars A-future-incompat Area: future incompatible reporting A-manifest Area: Cargo.toml issues A-registries Area: registries A-sparse-registry Area: http sparse registries A-timings Area: timings Command-fix Command-package Command-vendor S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 9, 2024
@rustbot rustbot added A-git Area: anything dealing with git Command-add labels Aug 9, 2024
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No objection to these changes. Thank you!

src/cargo/core/registry.rs Show resolved Hide resolved
src/cargo/ops/cargo_add/mod.rs Outdated Show resolved Hide resolved
crates/rustfix/tests/parse_and_replace.rs Outdated Show resolved Hide resolved
Inline variables in `format!`

Co-authored-by: Weihang Lo <weihanglo@users.noreply.github.com>
@mo8it mo8it requested a review from weihanglo August 9, 2024 13:45
@weihanglo
Copy link
Member

@bors r+

Thanks!

@bors
Copy link
Collaborator

bors commented Aug 9, 2024

📌 Commit af04e54 has been approved by weihanglo

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 9, 2024
@bors
Copy link
Collaborator

bors commented Aug 9, 2024

⌛ Testing commit af04e54 with merge 73a1b76...

@bors
Copy link
Collaborator

bors commented Aug 9, 2024

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing 73a1b76 to master...

@bors bors merged commit 73a1b76 into rust-lang:master Aug 9, 2024
22 checks passed
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 14, 2024
Update cargo

7 commits in 0d8d22f83b066503f6b2b755925197e959e58b4f..2f738d617c6ead388f899802dd1a7fd66858a691
2024-08-08 12:54:24 +0000 to 2024-08-13 10:57:52 +0000
- chore: downgrade to openssl v1.1.1 (again) (rust-lang/cargo#14391)
- feat(trim-paths): rustdoc supports trim-paths for diagnostics (rust-lang/cargo#14389)
- Use longhand gitoxide path-spec patterns (rust-lang/cargo#14380)
- feat: Add `info` cargo subcommand (rust-lang/cargo#14141)
- CI: Switch macos aarch64 to nightly (rust-lang/cargo#14382)
- Use context instead of with_context (rust-lang/cargo#14377)
- Fix: `cargo package` failed on bare commit git repo. (rust-lang/cargo#14359)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 14, 2024
Update cargo

7 commits in 0d8d22f83b066503f6b2b755925197e959e58b4f..2f738d617c6ead388f899802dd1a7fd66858a691
2024-08-08 12:54:24 +0000 to 2024-08-13 10:57:52 +0000
- chore: downgrade to openssl v1.1.1 (again) (rust-lang/cargo#14391)
- feat(trim-paths): rustdoc supports trim-paths for diagnostics (rust-lang/cargo#14389)
- Use longhand gitoxide path-spec patterns (rust-lang/cargo#14380)
- feat: Add `info` cargo subcommand (rust-lang/cargo#14141)
- CI: Switch macos aarch64 to nightly (rust-lang/cargo#14382)
- Use context instead of with_context (rust-lang/cargo#14377)
- Fix: `cargo package` failed on bare commit git repo. (rust-lang/cargo#14359)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 15, 2024
Update cargo

7 commits in 0d8d22f83b066503f6b2b755925197e959e58b4f..2f738d617c6ead388f899802dd1a7fd66858a691
2024-08-08 12:54:24 +0000 to 2024-08-13 10:57:52 +0000
- chore: downgrade to openssl v1.1.1 (again) (rust-lang/cargo#14391)
- feat(trim-paths): rustdoc supports trim-paths for diagnostics (rust-lang/cargo#14389)
- Use longhand gitoxide path-spec patterns (rust-lang/cargo#14380)
- feat: Add `info` cargo subcommand (rust-lang/cargo#14141)
- CI: Switch macos aarch64 to nightly (rust-lang/cargo#14382)
- Use context instead of with_context (rust-lang/cargo#14377)
- Fix: `cargo package` failed on bare commit git repo. (rust-lang/cargo#14359)

r? ghost
@rustbot rustbot added this to the 1.82.0 milestone Aug 15, 2024
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Aug 29, 2024
Update cargo

7 commits in 0d8d22f83b066503f6b2b755925197e959e58b4f..2f738d617c6ead388f899802dd1a7fd66858a691
2024-08-08 12:54:24 +0000 to 2024-08-13 10:57:52 +0000
- chore: downgrade to openssl v1.1.1 (again) (rust-lang/cargo#14391)
- feat(trim-paths): rustdoc supports trim-paths for diagnostics (rust-lang/cargo#14389)
- Use longhand gitoxide path-spec patterns (rust-lang/cargo#14380)
- feat: Add `info` cargo subcommand (rust-lang/cargo#14141)
- CI: Switch macos aarch64 to nightly (rust-lang/cargo#14382)
- Use context instead of with_context (rust-lang/cargo#14377)
- Fix: `cargo package` failed on bare commit git repo. (rust-lang/cargo#14359)

r? ghost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build-execution Area: anything dealing with executing the compiler A-build-scripts Area: build.rs scripts A-configuration Area: cargo config files and env vars A-future-incompat Area: future incompatible reporting A-git Area: anything dealing with git A-manifest Area: Cargo.toml issues A-registries Area: registries A-sparse-registry Area: http sparse registries A-timings Area: timings Command-add Command-fix Command-package Command-vendor S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants