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

🚨 Setup CI to run linting using cargo clippy #22

Merged
merged 7 commits into from
Jan 3, 2025
Merged

🚨 Setup CI to run linting using cargo clippy #22

merged 7 commits into from
Jan 3, 2025

Conversation

weiji14
Copy link
Owner

@weiji14 weiji14 commented Dec 13, 2024

Run cargo clippy --all-targets --all-features on Continuous Integration on every Pull Request and push to main.

TODO:

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
@weiji14 weiji14 added this to the 0.1.0 milestone Dec 13, 2024
@weiji14 weiji14 self-assigned this Dec 13, 2024
@weiji14
Copy link
Owner Author

weiji14 commented Dec 13, 2024

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.

@weiji14 weiji14 marked this pull request as ready for review January 3, 2025 03:49
@weiji14 weiji14 enabled auto-merge (squash) January 3, 2025 03:50
@weiji14 weiji14 merged commit ee77d4f into main Jan 3, 2025
15 checks passed
@weiji14 weiji14 deleted the ci/clippy branch January 3, 2025 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant