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

Dependency bump and clippy #347

Merged
merged 14 commits into from
Aug 21, 2023
Merged

Conversation

jqnatividad
Copy link
Contributor

bump dependencies and apply select clippy lint suggestions

warning: this expression creates a reference which is immediately dereferenced by the compiler
    --> src/xls.rs:1003:42
     |
1003 |                     .map_or("#REF", |sh| &sh);
     |                                          ^^^ help: change this to: `sh`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
     = note: `#[warn(clippy::needless_borrow)]` on by default
warning: this argument is a mutable reference, but not used mutably
   --> src/xls.rs:610:53
    |
610 | fn parse_short_string(r: &mut Record<'_>, encoding: &mut XlsEncoding) -> Result<String, XlsError> {
    |                                                     ^^^^^^^^^^^^^^^^ help: consider changing to: `&XlsEncoding`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
    = note: `#[warn(clippy::needless_pass_by_ref_mut)]` on by default

warning: this argument is a mutable reference, but not used mutably
   --> src/xls.rs:627:37
    |
627 | fn parse_string(r: &[u8], encoding: &mut XlsEncoding) -> Result<String, XlsError> {
    |                                     ^^^^^^^^^^^^^^^^ help: consider changing to: `&XlsEncoding`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
   --> src/xls.rs:725:16
    |
725 | fn parse_xf(r: &mut Record<'_>) -> Result<u16, XlsError> {
    |                ^^^^^^^^^^^^^^^ help: consider changing to: `&Record<'_>`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
   --> src/xls.rs:742:15
    |
742 |     encoding: &mut XlsEncoding,
    |               ^^^^^^^^^^^^^^^^ help: consider changing to: `&XlsEncoding`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
   --> src/xls.rs:816:15
    |
816 |     encoding: &mut XlsEncoding,
    |               ^^^^^^^^^^^^^^^^ help: consider changing to: `&XlsEncoding`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
   --> src/xls.rs:839:15
    |
839 |     encoding: &mut XlsEncoding,
    |               ^^^^^^^^^^^^^^^^ help: consider changing to: `&XlsEncoding`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
   --> src/xls.rs:841:10
    |
841 |     len: &mut usize,
    |          ^^^^^^^^^^ help: consider changing to: `&usize`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
warning: this argument is a mutable reference, but not used mutably
   --> src/xls.rs:463:15
    |
463 |     encoding: &mut XlsEncoding,
    |               ^^^^^^^^^^^^^^^^ help: consider changing to: `&XlsEncoding`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
    = note: `#[warn(clippy::needless_pass_by_ref_mut)]` on by default

warning: this argument is a mutable reference, but not used mutably
   --> src/xls.rs:768:15
    |
768 |     encoding: &mut XlsEncoding,
    |               ^^^^^^^^^^^^^^^^ help: consider changing to: `&XlsEncoding`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut

warning: this argument is a mutable reference, but not used mutably
   --> src/xls.rs:985:15
    |
985 |     encoding: &mut XlsEncoding,
    |               ^^^^^^^^^^^^^^^^ help: consider changing to: `&XlsEncoding`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
warning: you don't need to add `&` to all patterns
    --> src/xls.rs:1304:5
     |
1304 | /     match r {
1305 | |         &[0x00, .., 0xFF, 0xFF] => Ok(None), // String, value should be in next record
1306 | |         &[0x01, _, b, .., 0xFF, 0xFF] => Ok(Some(DataType::Bool(b != 0))),
1307 | |         &[0x02, _, e, .., 0xFF, 0xFF] => parse_err(e).map(Some),
...    |
1312 | |         _ => Ok(Some(DataType::Float(read_f64(r)))),
1313 | |     }
     | |_____^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_ref_pats
     = note: `#[warn(clippy::match_ref_pats)]` on by default
help: instead of prefixing all patterns with `&`, you can dereference the expression
     |
1304 ~     match *r {
1305 ~         [0x00, .., 0xFF, 0xFF] => Ok(None), // String, value should be in next record
1306 ~         [0x01, _, b, .., 0xFF, 0xFF] => Ok(Some(DataType::Bool(b != 0))),
1307 ~         [0x02, _, e, .., 0xFF, 0xFF] => parse_err(e).map(Some),
1308 ~         [e, .., 0xFF, 0xFF] => Err(XlsError::Unrecognized {
warning: the function `parse_format` doesn't need a mutable reference
   --> src/xls.rs:292:66
    |
292 |                         let (idx, format) = parse_format(&mut r, &mut encoding)?;
    |                                                                  ^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
    = note: `#[warn(clippy::unnecessary_mut_passed)]` on by default

warning: the function `parse_xf` doesn't need a mutable reference
   --> src/xls.rs:297:43
    |
297 |                         xfs.push(parse_xf(&mut r)?);
    |                                           ^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed

warning: the function `parse_sheet_name` doesn't need a mutable reference
   --> src/xls.rs:301:68
    |
301 |                         let (pos, name) = parse_sheet_name(&mut r, &mut encoding)?;
    |                                                                    ^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed

warning: the function `read_unicode_string_no_cch` doesn't need a mutable reference
   --> src/xls.rs:311:29
    |
311 | ...                   &mut encoding,
    |                       ^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed

warning: the function `read_unicode_string_no_cch` doesn't need a mutable reference
   --> src/xls.rs:313:29
    |
313 | ...                   &mut cch,
    |                       ^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed

warning: the function `parse_sst` doesn't need a mutable reference
   --> src/xls.rs:329:59
    |
329 |                     0x00FC => strings = parse_sst(&mut r, &mut encoding)?, // SST
    |                                                           ^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed
    = note: `#[warn(clippy::unnecessary_mut_passed)]` on by default

warning: the function `parse_string` doesn't need a mutable reference
   --> src/xls.rs:396:73
    |
396 |                         let val = DataType::String(parse_string(r.data, &mut encoding)?);
    |                                                                         ^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed

warning: the function `parse_formula` doesn't need a mutable reference
   --> src/xls.rs:425:29
    |
425 | ...                   &mut encoding,
    |                       ^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed

warning: the function `read_unicode_string_no_cch` doesn't need a mutable reference
    --> src/xls.rs:1104:66
     |
1104 |                 read_unicode_string_no_cch(encoding, &rgce[1..], &mut cch, &mut formula);
     |                                                                  ^^^^^^^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_mut_passed

warning: this argument is a mutable reference, but not used mutably
   --> src/xls.rs:704:44
    |
704 | fn parse_sst(r: &mut Record<'_>, encoding: &mut XlsEncoding) -> Result<Vec<String>, XlsError> {
    |                                            ^^^^^^^^^^^^^^^^ help: consider changing to: `&XlsEncoding`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
    = note: `#[warn(clippy::needless_pass_by_ref_mut)]` on by default
@jqnatividad
Copy link
Contributor Author

jqnatividad commented Aug 16, 2023

Hi @tafia ,
The PR is failing the Rust 1.60.0 test because the flate2 crate is deriving defaults on enums.

This feature has been stable since Rust 1.62. Do you need calamine to work on 1.60 for a particular reason?

Any chance we can bump the MSRV to 1.62.0, and while we're at it, maybe even bump the edition to 2021?

@tafia
Copy link
Owner

tafia commented Aug 16, 2023

No particular strong reason. You can move it to 1.62.

@tafia
Copy link
Owner

tafia commented Aug 16, 2023

I'm afraid there is now a conflict though due to older PR being merged. Could you fix it?

jqnatividad added a commit to jqnatividad/calamine that referenced this pull request Aug 17, 2023
required by flate2 dependency use by zip 0.6.6 so CI tests will work for tafia#347
warning: this `impl` can be derived
  --> src/datatype.rs:42:1
   |
42 | / impl Default for DataType {
43 | |     fn default() -> DataType {
44 | |         DataType::Empty
45 | |     }
46 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls
   = note: `#[warn(clippy::derivable_impls)]` on by default
   = help: remove the manual implementation...
help: ...and instead derive it...
   |
19 + #[derive(Default)]
20 | pub enum DataType {
   |
help: ...and mark the default variant
   |
39 ~     #[default]
40 ~     Empty,
@jqnatividad
Copy link
Contributor Author

Hi @tafia ,
I resolved the conflicts and bumped MSRV to 1.62.1 and edition to 2021.

I also went ahead and derived Default for DataType now that we're using 1.62.1.

@tafia tafia merged commit a54bd9c into tafia:master Aug 21, 2023
@tafia
Copy link
Owner

tafia commented Aug 21, 2023

Awesome thanks!

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 this pull request may close these issues.

2 participants