Closed
Conversation
Proposing to replace
```rust
let mut x = PathBuf::from("/foo");
x.push("/bar");
```
by
```rust
let mut x = PathBuf::from("/foo");
x.push("bar");
```
changes the content of `x` (`/bar` ⇒ `/foo/bar`).
By assuming that a recursive type is normalizable within the deeper calls to `is_normalizable_helper()`, more cases can be handled by this function. In order to fix stack overflows, a recursion limit has also been added for recursive generic type instantiations.
`manual_ok_or` covers the same case that were covered by `option_map_or_err_ok` which is not deprecated. The latter was in the "style" category. Also, the lint is machine applicable, and leads to shorter and more readable code, so "style" is appropriate. The only difference is that the η-expanded form of `Result::Ok()` was not covered by `option_map_or_err_ok` while it is by `manual_ok_or`, so the category change may expose some new occurrences.
Removing the `.as_ref()` or `.as_mut()` as the top-level expression in a closure may change the type of the result. In this case, it may be better not to lint rather than proposing a fix that would not work.
Labeled blocks cannot be used as-is in the "then" or "else" part of an `if` expression. They must be enclosed in an anonymous block.
This is the lint described at rust-lang#136308 (comment) that recommends using HTML to nest links inside code.
- `reindent_multiline()` always returns the result of
`reindent_multiline_inner()` which returns a `String`. Make
`reindent_multiline()` return a `String` as well, instead of a
systematically owned `Cow<'_, str>`.
- There is no reason for `reindent_multiline()` to force a caller to
build a `Cow<'_, str>` instead of passing a `&str` directly,
especially considering that a `String` will always be returned.
Also, both the input parameter and return value (of type `Cow<'_, str>`)
shared the same (elided) lifetime for no reason: this worked only because
the result was always the `Cow::Owned` variant which is compatible with
any lifetime.
As a consequence, the signature changes from:
```rust
fn reindent_multiline(s: Cow<'_, str>, …) -> Cow<'_, str> { … }
```
to
```rust
fn reindent_multiline(s: &str, …) -> String { … }
```
Member
|
@bors r+ |
Collaborator
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 20, 2025
…nishearth Clippy subtree update r? `@Manishearth` `Cargo.lock` change because of Clippy version bump and `rustc_tool_utils` new release.
This comment has been minimized.
This comment has been minimized.
Collaborator
|
💔 Test failed - checks-actions |
Member
Author
Collaborator
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 21, 2025
…nishearth Clippy subtree update r? `@Manishearth` `Cargo.lock` change because of Clippy version bump and `rustc_tool_utils` new release.
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Collaborator
|
💔 Test failed - checks-actions |
Collaborator
|
☔ The latest upstream changes (presumably #137348) made this pull request unmergeable. Please resolve the merge conflicts. |
Member
Author
|
I don't get the error here. The only |
Member
Didn't dig further for where the jq invocation is happening etc. |
Member
|
Member
Author
|
Will open a new PR. Have to do this sync. |
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.
r? @Manishearth
Cargo.lockchange because of Clippy version bump andrustc_tool_utilsnew release.