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

Clippy - useless_conversion error in qsc_frontend when building the playground locally #2256

Open
irfanghat opened this issue Mar 27, 2025 · 2 comments · May be fixed by #2259
Open

Clippy - useless_conversion error in qsc_frontend when building the playground locally #2256

irfanghat opened this issue Mar 27, 2025 · 2 comments · May be fixed by #2259

Comments

@irfanghat
Copy link

Describe the Issue

Running ./build.py in the qsharp repo fails due to Clippy's useless_conversion lint in qsc_frontend. This issue prevents building the Playground locally.

Error Message

error: useless conversion to the same type: `typeck::convert::TyConversionError`
   --> compiler/qsc_frontend/src/typeck/convert.rs:261:21
    |
261 |            .into_iter()
    |   _____________________^
    |  |_____________________|  
262 | ||         .map(TyConversionError::from)
    | ||_____________________________________^
263 | |          .collect::<Vec<_>>();
    | |_________- help: consider removing
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
    = note: `-D clippy::useless-conversion` implied by `-D warnings`

Steps to Reproduce

  1. Clone the qsharp repo.
  2. Run ./build.py in the root directory.
  3. The build fails due to clippy::useless_conversion.

Environment

  • Rust Version: rustc --version 1.85.1
  • Cargo Version: cargo --version 1.85.1
  • Clippy Version: cargo clippy --version 0.1.85
@absoludity
Copy link

absoludity commented Mar 28, 2025

I just had the same experience (actually, the above and another in ast_context.rs). I guess clippy gets updated pretty regularly?

Anyway, I've fixed both and will push a PR (and sign the agreement).

absoludity added a commit to absoludity/qsharp that referenced this issue Mar 28, 2025
Remove unnecessary conversion picked up by the latest Clippy in
convert.rs

Switch to use .is_none_or instead of .map_or in ast_context.rs.

Fixes microsoft#2256
@irfanghat
Copy link
Author

Awesome @absoludity, I'll give it a try once the PR is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants