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

refactor: replace &PathBuf with &Path to enhance generality #134420

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

Integral-Tech
Copy link
Contributor

@Integral-Tech Integral-Tech commented Dec 17, 2024

More generally, always prefer types on the left

// GOOD      BAD
&[T]         &Vec<T>
&str         &String
Option<&T>   &Option<T>
&Path        &PathBuf

@rustbot
Copy link
Collaborator

rustbot commented Dec 17, 2024

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @compiler-errors (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-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 17, 2024
@rustbot
Copy link
Collaborator

rustbot commented Dec 17, 2024

Some changes occurred in src/tools/compiletest

cc @jieyouxu

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Dec 17, 2024

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

Some changes occurred in src/tools/compiletest

cc @jieyouxu

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

Hi. Thanks for the contribution, but please revert changes to subtrees like rustfmt.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 17, 2024
@Integral-Tech
Copy link
Contributor Author

@compiler-errors Done :)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 17, 2024
@compiler-errors
Copy link
Member

Generally I want to discourage using the rust-analyzer style guide to make basically non-functional changes to rust-lang/rust, but since this is already done I'll approve it.

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Dec 17, 2024

📌 Commit 7eb0d84 has been approved by compiler-errors

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 Dec 17, 2024
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Dec 18, 2024
…compiler-errors

refactor: replace &PathBuf with &Path to enhance generality

- According to [style.md](https://github.com/rust-lang/rust/blob/master/src/tools/rust-analyzer/docs/dev/style.md#useless-types):

> More generally, always prefer types on the left
```rust
// GOOD      BAD
&[T]         &Vec<T>
&str         &String
Option<&T>   &Option<T>
&Path        &PathBuf
```
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Dec 18, 2024
…compiler-errors

refactor: replace &PathBuf with &Path to enhance generality

- According to [style.md](https://github.com/rust-lang/rust/blob/master/src/tools/rust-analyzer/docs/dev/style.md#useless-types):

> More generally, always prefer types on the left
```rust
// GOOD      BAD
&[T]         &Vec<T>
&str         &String
Option<&T>   &Option<T>
&Path        &PathBuf
```
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Dec 18, 2024
…compiler-errors

refactor: replace &PathBuf with &Path to enhance generality

- According to [style.md](https://github.com/rust-lang/rust/blob/master/src/tools/rust-analyzer/docs/dev/style.md#useless-types):

> More generally, always prefer types on the left
```rust
// GOOD      BAD
&[T]         &Vec<T>
&str         &String
Option<&T>   &Option<T>
&Path        &PathBuf
```
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Dec 18, 2024
…compiler-errors

refactor: replace &PathBuf with &Path to enhance generality

- According to [style.md](https://github.com/rust-lang/rust/blob/master/src/tools/rust-analyzer/docs/dev/style.md#useless-types):

> More generally, always prefer types on the left
```rust
// GOOD      BAD
&[T]         &Vec<T>
&str         &String
Option<&T>   &Option<T>
&Path        &PathBuf
```
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 18, 2024
Rollup of 8 pull requests

Successful merges:

 - rust-lang#133702 (Variants::Single: do not use invalid VariantIdx for uninhabited enums)
 - rust-lang#133926 (Fix const conditions for RPITITs)
 - rust-lang#134161 (Overhaul token cursors)
 - rust-lang#134253 (Overhaul keyword handling)
 - rust-lang#134394 (Clarify the match ergonomics 2024 migration lint's output)
 - rust-lang#134420 (refactor: replace &PathBuf with &Path to enhance generality)
 - rust-lang#134444 (Fix `x build --stage 1 std` when using cg_cranelift as the default backend)
 - rust-lang#134452 (fix(LazyCell): documentation of get[_mut] was wrong)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 18, 2024
Rollup of 11 pull requests

Successful merges:

 - rust-lang#130786 ( mir-opt: a sub-BB of a cleanup BB must also be a cleanup BB in `EarlyOtherwiseBranch`)
 - rust-lang#133926 (Fix const conditions for RPITITs)
 - rust-lang#134161 (Overhaul token cursors)
 - rust-lang#134253 (Overhaul keyword handling)
 - rust-lang#134394 (Clarify the match ergonomics 2024 migration lint's output)
 - rust-lang#134399 (Do not do if ! else, use unnegated cond and swap the branches instead)
 - rust-lang#134420 (refactor: replace &PathBuf with &Path to enhance generality)
 - rust-lang#134436 (tests/assembly/asm: Remove uses of rustc_attrs and lang_items features by using minicore)
 - rust-lang#134444 (Fix `x build --stage 1 std` when using cg_cranelift as the default backend)
 - rust-lang#134452 (fix(LazyCell): documentation of get[_mut] was wrong)
 - rust-lang#134460 (Merge some patterns together)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 099faa8 into rust-lang:master Dec 18, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 18, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 18, 2024
Rollup merge of rust-lang#134420 - Integral-Tech:pathbuf-refactor, r=compiler-errors

refactor: replace &PathBuf with &Path to enhance generality

- According to [style.md](https://github.com/rust-lang/rust/blob/master/src/tools/rust-analyzer/docs/dev/style.md#useless-types):

> More generally, always prefer types on the left
```rust
// GOOD      BAD
&[T]         &Vec<T>
&str         &String
Option<&T>   &Option<T>
&Path        &PathBuf
```
Integral-Tech added a commit to Integral-Tech/rust that referenced this pull request Dec 27, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 27, 2024
tools: fix build failure caused by PR rust-lang#134420

Someone reports build failure after merging pull request rust-lang#134420: rust-lang#134420 (comment)

This pull request fixes the build failure.
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Dec 27, 2024
tools: fix build failure caused by PR rust-lang#134420

Someone reports build failure after merging pull request rust-lang#134420: rust-lang#134420 (comment)

This pull request fixes the build failure.
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 27, 2024
Rollup of 8 pull requests

Successful merges:

 - rust-lang#134606 (ptr::copy: fix docs for the overlapping case)
 - rust-lang#134622 (Windows: Use WriteFile to write to a UTF-8 console)
 - rust-lang#134759 (compiletest: Remove the `-test` suffix from normalize directives)
 - rust-lang#134787 (Spruce up the docs of several queries related to the type/trait system and const eval)
 - rust-lang#134806 (rustdoc: use shorter paths as preferred canonical paths)
 - rust-lang#134815 (Sort triples by name in platform_support.md)
 - rust-lang#134816 (tools: fix build failure caused by PR rust-lang#134420)
 - rust-lang#134819 (Fix mistake in windows file open)

r? `@ghost`
`@rustbot` modify labels: rollup
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 27, 2024
Rollup merge of rust-lang#134816 - Integral-Tech:pathbuf-refactor, r=lqd

tools: fix build failure caused by PR rust-lang#134420

Someone reports build failure after merging pull request rust-lang#134420: rust-lang#134420 (comment)

This pull request fixes the build failure.
poliorcetics pushed a commit to poliorcetics/rust that referenced this pull request Dec 28, 2024
tools: fix build failure caused by PR rust-lang#134420

Someone reports build failure after merging pull request rust-lang#134420: rust-lang#134420 (comment)

This pull request fixes the build failure.
poliorcetics pushed a commit to poliorcetics/rust that referenced this pull request Dec 28, 2024
Rollup of 8 pull requests

Successful merges:

 - rust-lang#134606 (ptr::copy: fix docs for the overlapping case)
 - rust-lang#134622 (Windows: Use WriteFile to write to a UTF-8 console)
 - rust-lang#134759 (compiletest: Remove the `-test` suffix from normalize directives)
 - rust-lang#134787 (Spruce up the docs of several queries related to the type/trait system and const eval)
 - rust-lang#134806 (rustdoc: use shorter paths as preferred canonical paths)
 - rust-lang#134815 (Sort triples by name in platform_support.md)
 - rust-lang#134816 (tools: fix build failure caused by PR rust-lang#134420)
 - rust-lang#134819 (Fix mistake in windows file open)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) 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.

6 participants