-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
🚨 Setup CI to run linting using cargo clippy #22
Merged
Conversation
This file contains 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
Run `cargo clippy --all-targets --all-features` on Continuous Integration on every Pull Request and push to main. Adapted from https://doc.rust-lang.org/stable/clippy/continuous_integration/github_actions.html
Copy of clippy lint errors from https://github.com/weiji14/cog3pio/actions/runs/12322416017/job/34395934063?pr=22#step:3:334: error: useless conversion to the same type: `std::vec::Vec<T>`
--> src/io/geotiff.rs:84:13
|
84 | image_data.into(),
| ^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `image_data`
|
= 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`
= help: to override `-D warnings` add `#[allow(clippy::useless_conversion)]`
error: methods with the following characteristics: (`to_*` and `self` type is not `Copy`) usually take `self` by reference
--> src/python/adapters.rs:63:22
|
63 | fn to_numpy<'py>(&mut self, py: Python<'py>) -> PyResult<Bound<'py, PyArray3<f32>>> {
| ^^^^^^^^^
|
= help: consider choosing a less ambiguous name
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention
= note: `-D clippy::wrong-self-convention` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::wrong_self_convention)]`
error: very complex type used. Consider factoring parts into `type` definitions
--> src/python/adapters.rs:77:10
|
77 | ) -> PyResult<(Bound<'py, PyArray1<f64>>, Bound<'py, PyArray1<f64>>)> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity
= note: `-D clippy::type-complexity` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::type_complexity)]`
error: the following explicit lifetimes could be elided: 'py
--> src/python/adapters.rs:154:12
|
154 | fn cog3pio<'py>(_py: Python, m: &Bound<'py, PyModule>) -> PyResult<()> {
| ^^^ ^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
= note: `-D clippy::needless-lifetimes` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::needless_lifetimes)]`
help: elide the lifetimes
|
154 - fn cog3pio<'py>(_py: Python, m: &Bound<'py, PyModule>) -> PyResult<()> {
154 + fn cog3pio(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
|
error: could not compile `cog3pio` (lib) due to 4 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `cog3pio` (lib test) due to 4 previous errors
Error: Process completed with exit code 101. |
Fixes `error: methods with the following characteristics: (`to_*` and `self` type is not `Copy`) usually take `self` by reference`. Xref https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention
Silence `error: very complex type used. Consider factoring parts into `type` definitions`. Xref https://rust-lang.github.io/rust-clippy/stable/index.html#/type_complexity
Missed a few more method renames of `to_numpy` to `as_numpy` in commit ef4cc71.
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.
Run
cargo clippy --all-targets --all-features
on Continuous Integration on every Pull Request and push to main.TODO:
clippy::wrong-self-convention
- Fixed by renamingPyCogReader::to_numpy
method toPyCogReader::as_numpy
(clippy::type-complexity
- Silenced in commit 9b220bcclippy::needless-lifetimes
- fixed in commit b1f8782clippy::useless-conversion
- fixed in commit b178519