Skip to content

Remove unnecessary into conversions - #15042

Merged
weihanglo merged 1 commit into
rust-lang:masterfrom
estebank:unneeded-into
Jan 9, 2025
Merged

Remove unnecessary into conversions#15042
weihanglo merged 1 commit into
rust-lang:masterfrom
estebank:unneeded-into

Conversation

@estebank

@estebank estebank commented Jan 9, 2025

Copy link
Copy Markdown
Contributor

"identity" .into() calls where the base's type isn't changed is a future compatibility foot-gun (like the issue we had with time a few months ago) as new impl Into blocks can cause previously compiling code to start failing. I don't foresee these ones in particular causing problems anytime soon, but I noticed them and might as well clean them up as a drive-by.

@rustbot

rustbot commented Jan 9, 2025

Copy link
Copy Markdown
Collaborator

r? @ehuss

rustbot has assigned @ehuss.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-git Area: anything dealing with git S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 9, 2025
@estebank

estebank commented Jan 9, 2025

Copy link
Copy Markdown
Contributor Author

I noticed these while working on rust-lang/rust#129249. I am not confident that there's no platform specific shenanigans that make these .into() calls necessary, like they it is for:

error: this conversion is useless `u64` to `u64`
   --> src/tools/cargo/src/cargo/core/shell.rs:611:49
    |
611 |             if libc::ioctl(libc::STDERR_FILENO, libc::TIOCGWINSZ.into(), &mut winsize) < 0 {
    |
    = note: `#[deny(self_type_conversion)]` on by default

I am working on correctly handling that case (it shouldn't warn at all), but in the other two cases it does seem like the lint caught real cases of this.

@weihanglo weihanglo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks Esteban. Just want to confirm this doesn't really block rust-lang/rust#129249, right? I am collectin data for cargo-as-subtree in rust-lang/rust and wonder how painful it is not.

@weihanglo weihanglo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks Esteban. Just want to confirm this doesn't really block rust-lang/rust#129249, right? I am collectin data for cargo-as-subtree in rust-lang/rust and wonder how painful it is not.

@weihanglo
weihanglo enabled auto-merge January 9, 2025 19:34
@weihanglo
weihanglo added this pull request to the merge queue Jan 9, 2025
@estebank

estebank commented Jan 9, 2025

Copy link
Copy Markdown
Contributor Author

@weihanglo it doesn't block it, I worked around it on that PR for now (right now I only care about getting to the point of being able to run crater), but will become a nuisance at an indeterminate time in the future. I'm confident this can just ride the train without it becoming an issue for me (given my current speed on finishing that PR). Thanks for the concern! The PR in the end might not be landed (I'd push the new logic to clippy), or might be allow-by-default. Either way it wouldn't block progress for these to be present in our tooling. I just wanted to clean up some of the things I was seeing.

Merged via the queue into rust-lang:master with commit 9589831 Jan 9, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 11, 2025
Update cargo

18 commits in fd784878cfa843e3e29a6654ecf564c62fae6735..088d496082726091024f1689c124a0c3dccbd775
2025-01-03 20:06:26 +0000 to 2025-01-10 20:10:21 +0000
- docs(reference): Fix PkgIdSpec kind docs (rust-lang/cargo#15049)
- feat: Added warning when failing to update index cache (rust-lang/cargo#15014)
- docs(ref): Fix the inverted logic about MSRV (rust-lang/cargo#15044)
- chore(deps): update msrv (1 version) to v1.84 (rust-lang/cargo#15041)
- Remove unnecessary into conversions (rust-lang/cargo#15042)
- docs(contrib): Start guidelines for schema design (rust-lang/cargo#15037)
- fix: emit warnings as warnings when learning rust target info (rust-lang/cargo#15036)
- fix(schemas): Fix the `[lints]` JSON Schema (rust-lang/cargo#15035)
- fix(schemas): Fix 'metadata' JSON Schema (rust-lang/cargo#15033)
- shorten comment on Ord for SourceKind (rust-lang/cargo#15029)
- Make `"C"` explicit in `extern "C"`. (rust-lang/cargo#15034)
- simplify SourceID Ord/Eq (rust-lang/cargo#14980)
- Setup cargo environment for `cargo rustc --print` (rust-lang/cargo#15026)
- Avoid naming variables `str` (rust-lang/cargo#15025)
- Bump to 0.87.0; update changelog (rust-lang/cargo#15022)
- Update libgit2 to 1.9 (rust-lang/cargo#15018)
- Remove condition on RUSTUP_WINDOWS_PATH_ADD_BIN (rust-lang/cargo#15017)
- Fix https::self_signed_should_fail for macos (rust-lang/cargo#15016)
@rustbot rustbot added this to the 1.86.0 milestone Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-git Area: anything dealing with git S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants