valpackett / systemstat

Rust library for getting system information | also on https://codeberg.org/valpackett/systemstat

Home Page:https://crates.io/crates/systemstat

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiler Warnings on Latest Stable

adumbidiot opened this issue · comments

Attempting to use this library yields many compiler warnings. Here is what I get when i try to compile this on Windows 10 with the latest stable:

warning: unused `#[macro_use]` import
  --> src\lib.rs:10:1
   |
10 | #[macro_use]
   | ^^^^^^^^^^^^
   |
   = note: `#[warn(unused_imports)]` on by default

warning: use of deprecated item 'std::mem::uninitialized': use `mem::MaybeUninit` instead
   --> src\platform\windows\disk.rs:133:46
    |
133 |     let mut avail: ULARGE_INTEGER = unsafe { mem::uninitialized() };
    |                                              ^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

warning: use of deprecated item 'std::mem::uninitialized': use `mem::MaybeUninit` instead
   --> src\platform\windows\disk.rs:134:46
    |
134 |     let mut total: ULARGE_INTEGER = unsafe { mem::uninitialized() };
    |                                              ^^^^^^^^^^^^^^^^^^

warning: use of deprecated item 'std::mem::uninitialized': use `mem::MaybeUninit` instead
   --> src\platform\windows\disk.rs:135:45
    |
135 |     let mut free: ULARGE_INTEGER = unsafe { mem::uninitialized() };
    |                                             ^^^^^^^^^^^^^^^^^^

warning: use of deprecated item 'libc::uint8_t': Use u8 instead.
 --> src\platform\windows\network_interfaces.rs:1:42
  |
1 | use libc::{c_void, free, malloc, size_t, uint8_t};
  |                                          ^^^^^^^

warning: use of deprecated item 'libc::uint8_t': Use u8 instead.
  --> src\platform\windows\network_interfaces.rs:59:28
   |
59 |     on_link_prefix_length: uint8_t,
   |                            ^^^^^^^

warning: use of deprecated item 'libc::uint8_t': Use u8 instead.
   --> src\platform\windows\network_interfaces.rs:199:60
    |
199 | fn parse_addr_and_netmask(aptr: *const SOCKADDR, net_bits: uint8_t) -> NetworkAddrs {
    |                                                            ^^^^^^^

warning: unused variable: `path`
   --> src\platform\windows\mod.rs:295:46
    |
295 |     fn mount_at<P: AsRef<path::Path>>(&self, path: P) -> io::Result<Filesystem> {
    |                                              ^^^^ help: consider prefixing with an underscore: `_path`
    |
    = note: `#[warn(unused_variables)]` on by default

warning: unused variable: `interface`
   --> src\platform\windows\mod.rs:307:29
    |
307 |     fn network_stats(&self, interface: &str) -> io::Result<NetworkStats> {
    |                             ^^^^^^^^^ help: consider prefixing with an underscore: `_interface`

warning: unused variable: `rhs`
  --> src\data.rs:58:26
   |
58 |     pub fn avg_add(self, rhs: &Self) -> Self {
   |                          ^^^ help: consider prefixing with an underscore: `_rhs`

warning: unused variable: `input`
  --> src\data.rs:86:17
   |
86 |     pub fn from(input: f32) -> Self {
   |                 ^^^^^ help: consider prefixing with an underscore: `_input`

warning: function is never used: `physical_address_to_string`
   --> src\platform\windows\network_interfaces.rs:186:4
    |
186 | fn physical_address_to_string(array: &[u8; 8], length: DWORD) -> String {
    |    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

    Finished dev [unoptimized + debuginfo] target(s) in 5.61s

I think the worst thing here is the use of std::mem::uninitialized. Regardless, all the warnings should probably be fixed at some point.