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 lint warnings #184

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ impl LinuxPackageReadout {
/// Returns the number of installed packages for systems
/// that utilize `nix` as their package manager.
fn count_nix() -> Option<usize> {
return 'sqlite: {
'sqlite: {
let db = "/nix/var/nix/db/db.sqlite";
if !Path::new(db).is_file() {
break 'sqlite None;
Expand All @@ -1020,6 +1020,6 @@ impl LinuxPackageReadout {
}

None
};
}
}
}
8 changes: 2 additions & 6 deletions src/linux/pci_devices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,9 @@ impl PciDevice {
let device_value = self.read_value(PciDeviceReadableValues::Device);
let sub_device_value = self.read_value(PciDeviceReadableValues::SubDevice);

let Some(vendor) = db.vendors.get(&vendor_value) else {
return None;
};
let vendor = db.vendors.get(&vendor_value)?;
let device = vendor.devices.get(&device_value)?;

let Some(device) = vendor.devices.get(&device_value) else {
return None;
};
// To return device name if no valid subdevice name is found
let device_name = device.name.to_owned();

Expand Down
1 change: 0 additions & 1 deletion src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,6 @@ pub trait GeneralReadout {

_e.g._ /bin/bash, /bin/zsh, etc.
*/

fn shell(&self, _shorthand: ShellFormat, kind: ShellKind) -> Result<String, ReadoutError>;

/// This function should return the model name of the CPU \
Expand Down
8 changes: 4 additions & 4 deletions src/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ impl MemoryReadout for WindowsMemoryReadout {
}

fn swap_total(&self) -> Result<u64, ReadoutError> {
return Err(ReadoutError::NotImplemented);
Err(ReadoutError::NotImplemented)
}

fn swap_free(&self) -> Result<u64, ReadoutError> {
return Err(ReadoutError::NotImplemented);
Err(ReadoutError::NotImplemented)
}

fn swap_used(&self) -> Result<u64, ReadoutError> {
return Err(ReadoutError::NotImplemented);
Err(ReadoutError::NotImplemented)
}
}

Expand Down Expand Up @@ -350,7 +350,7 @@ impl GeneralReadout for WindowsGeneralReadout {
))
}

fn disk_space(&self, path: &Path) -> Result<(u64, u64), ReadoutError> {
fn disk_space(&self, _path: &Path) -> Result<(u64, u64), ReadoutError> {
Err(ReadoutError::NotImplemented)
}

Expand Down
7 changes: 6 additions & 1 deletion src/winman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub fn detect_xorg_window_manager() -> Result<String, ReadoutError> {
}

if extra::which("wmctrl") {
let wmctrl = Command::new("wmctrl")
let mut wmctrl = Command::new("wmctrl")
.arg("-m")
.stdout(Stdio::piped())
.stderr(Stdio::piped())
Expand All @@ -117,6 +117,7 @@ pub fn detect_xorg_window_manager() -> Result<String, ReadoutError> {

let wmctrl_out = wmctrl
.stdout
.take()
.expect("ERROR: failed to open \"wmctrl\" stdout");

let head = Command::new("head")
Expand All @@ -130,6 +131,10 @@ pub fn detect_xorg_window_manager() -> Result<String, ReadoutError> {
.wait_with_output()
.expect("ERROR: failed to wait for \"head\" process to exit");

wmctrl
.wait()
.expect("ERROR: failed to wait for \"wmctrl\" process to exit");

let window_manager = String::from_utf8(output.stdout)
.expect("ERROR: \"wmctrl -m | head -n1\" process stdout was not valid UTF-8");

Expand Down
Loading