mirror of
https://github.com/orhun/systeroid
synced 2024-07-21 10:25:00 +00:00
fix(lint): apply clippy suggestions
This commit is contained in:
parent
aa78731b3f
commit
c98e427d2c
|
@ -46,12 +46,12 @@ impl Sysctl {
|
|||
let parameter = self
|
||||
.parameters
|
||||
.iter_mut()
|
||||
.find(|param| param.name == *param_name.replace("/", "."));
|
||||
.find(|param| param.name == *param_name.replace('/', "."));
|
||||
if parameter.is_none() && !self.config.ignore_errors {
|
||||
eprintln!(
|
||||
"{}: cannot stat /proc/{}: No such file or directory",
|
||||
env!("CARGO_PKG_NAME").split('-').collect::<Vec<_>>()[0],
|
||||
param_name.replace(".", "/")
|
||||
param_name.replace('.', "/")
|
||||
)
|
||||
}
|
||||
parameter
|
||||
|
@ -63,16 +63,16 @@ impl Sysctl {
|
|||
.parameters
|
||||
.iter()
|
||||
.filter(|param| {
|
||||
param.name == query.replace("/", ".")
|
||||
param.name == query.replace('/', ".")
|
||||
|| param.section.to_string() == query
|
||||
|| param.absolute_name() == Some(&query.replace("/", "."))
|
||||
|| param.absolute_name() == Some(&query.replace('/', "."))
|
||||
})
|
||||
.collect::<Vec<&Parameter>>();
|
||||
if parameters.is_empty() {
|
||||
eprintln!(
|
||||
"{}: cannot stat /proc/{}: No such file or directory",
|
||||
env!("CARGO_PKG_NAME").split('-').collect::<Vec<_>>()[0],
|
||||
query.replace(".", "/")
|
||||
query.replace('.', "/")
|
||||
)
|
||||
}
|
||||
parameters
|
||||
|
|
|
@ -37,7 +37,7 @@ impl From<String> for Section {
|
|||
impl<'a> From<&'a Path> for Section {
|
||||
fn from(value: &'a Path) -> Self {
|
||||
for section in Self::variants() {
|
||||
if value.file_stem().map(|v| v.to_str()).flatten() == Some(§ion.to_string()) {
|
||||
if value.file_stem().and_then(|v| v.to_str()) == Some(§ion.to_string()) {
|
||||
return *section;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue