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

fix all warnings and some clippy lints #160

Merged
merged 1 commit into from Nov 23, 2021

Conversation

pymongo
Copy link
Contributor

@pymongo pymongo commented Nov 11, 2021

No description provided.

@pymongo
Copy link
Contributor Author

pymongo commented Nov 11, 2021

I spent a lot of time to fix all rustc/clippy warnings, please take a look, thanks

@pymongo
Copy link
Contributor Author

pymongo commented Nov 11, 2021

I fix all clippy lints exclude this

[w@ww procfs]$ cargo clippy
warning: lint `clippy::unknown_clippy_lints` has been renamed to `unknown_lints`
 --> src/lib.rs:3:10
  |
3 | #![allow(clippy::unknown_clippy_lints)]
  |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unknown_lints`
  |
  = note: `#[warn(renamed_and_removed_lints)]` on by default

warning: `procfs` (lib) generated 1 warning

@eminence
Copy link
Owner

Hi, thanks for the fixes.

Can you please also test with rust 1.34 and rust 1.42? Some of the changes are not compatible with these older versions of rust, for example:

error[E0658]: use of unstable library feature 'range_contains': recently added as per RFC (see issue #32311)
   --> src/pressure.rs:158:23
    |
158 |         (0.00..100.0).contains(&value)
    |                       ^^^^^^^^

error: aborting due to previous error

@pymongo
Copy link
Contributor Author

pymongo commented Nov 12, 2021

sorry, both 1.34 and 1.42 could not compile on my computer due to other dependencies, so I could only wait CI to check 1.34 and 1.42 compile

[w@ww procfs]$ cargo +1.34 check
    Updating crates.io index
  Downloaded hex v0.4.3
  Downloaded byteorder v1.4.3
  Downloaded chrono v0.4.19
  Downloaded lazy_static v1.4.0
  Downloaded bitflags v1.3.2
  Downloaded flate2 v1.0.22
  Downloaded libc v0.2.107
  Downloaded num-traits v0.2.14
  Downloaded num-integer v0.1.44
  Downloaded time v0.1.44
  Downloaded crc32fast v1.2.1
  Downloaded cfg-if v1.0.0
   Compiling autocfg v1.0.1
   Compiling libc v0.2.107
   Compiling crc32fast v1.2.1
    Checking cfg-if v1.0.0
    Checking adler v1.0.2
    Checking byteorder v1.4.3
    Checking hex v0.4.3
    Checking lazy_static v1.4.0
    Checking bitflags v1.3.2
error[E0658]: use of unstable library feature 'alloc': this library is unlikely to be stabilized in its current form or name (see issue #27783)
  --> /home/w/.cargo/registry/src/github.com-1ecc6299db9ec823/hex-0.4.3/src/lib.rs:41:1
   |
41 | extern crate alloc;
   | ^^^^^^^^^^^^^^^^^^^

   Compiling num-traits v0.2.14
   Compiling num-integer v0.1.44
   Compiling miniz_oxide v0.4.4
error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.
error: Could not compile `hex`.
warning: build failed, waiting for other jobs to finish...
error: build failed
[w@ww procfs]$ cargo clean && rm Cargo.lock 
[w@ww procfs]$ cargo +1.42 check
    Updating `https://rsproxy.cn/crates.io-index` index
   Compiling autocfg v1.0.1
   Compiling libc v0.2.107
   Compiling crc32fast v1.2.1
    Checking adler v1.0.2
    Checking cfg-if v1.0.0
    Checking bitflags v1.3.2
    Checking byteorder v1.4.3
    Checking lazy_static v1.4.0
    Checking hex v0.4.3
   Compiling num-traits v0.2.14
   Compiling num-integer v0.1.44
   Compiling miniz_oxide v0.4.4
    Checking time v0.1.44
    Checking flate2 v1.0.22
    Checking chrono v0.4.19
    Checking procfs v0.11.0 (/home/w/repos/fork_repos/procfs)
error[E0658]: `if` is not allowed in a `const fn`
   --> src/process/mod.rs:103:1
    |
103 | / bitflags! {
104 | |     /// Kernel flags for a process
105 | |     ///
106 | |     /// See also the [Stat::flags()] method.
...   |
171 | |     }
172 | | }
    | |_^

@eminence
Copy link
Owner

Check the README for more info, but if you want to test with 1.34, you have to manually pin some of the dependencies to older versions that will work with 1.34:

cargo update -p hex --precise 0.4.2
cargo update -p bitflags --precise 1.2.1
cargo update -p flate2 --precise 1.0.21

@pymongo
Copy link
Contributor Author

pymongo commented Nov 13, 2021

seems my code is pass 1.34 and 1.42 rustc compile in CI, any other problem need I to solve?

@eminence
Copy link
Owner

Thanks! I'll take a look in a few days

Copy link
Owner

@eminence eminence left a comment

Choose a reason for hiding this comment

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

Everything looks good here, except for 1 small issue on 32-bit linux. Thanks!

src/lib.rs Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
@eminence
Copy link
Owner

Thanks!

@eminence eminence merged commit fc91e46 into eminence:master Nov 23, 2021
@eminence eminence added this to the v0.12.0 milestone Nov 26, 2021
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.

None yet

2 participants