163 lines
6.1 KiB
Diff
163 lines
6.1 KiB
Diff
|
|
From 2af03514afcc797cac3125c7b04ee0f5eae43aa0 Mon Sep 17 00:00:00 2001
|
||
|
|
From: renoseven <dev@renoseven.net>
|
||
|
|
Date: Mon, 10 Feb 2025 10:29:00 +0800
|
||
|
|
Subject: [PATCH] all: fix cargo clippy warnings
|
||
|
|
|
||
|
|
Signed-off-by: renoseven <dev@renoseven.net>
|
||
|
|
---
|
||
|
|
syscare-common/src/ffi/os_str.rs | 2 +-
|
||
|
|
syscare-common/src/fs/fs_impl.rs | 4 ++--
|
||
|
|
syscare-common/src/os_str/iter.rs | 2 +-
|
||
|
|
syscare-common/src/process/stdio.rs | 4 ++--
|
||
|
|
syscared/src/args.rs | 1 -
|
||
|
|
syscared/src/patch/resolver/kpatch.rs | 2 +-
|
||
|
|
syscared/src/patch/resolver/upatch.rs | 2 +-
|
||
|
|
upatch-build/src/dwarf/mod.rs | 6 +++---
|
||
|
|
upatch-build/src/dwarf/relocate.rs | 4 ++--
|
||
|
|
9 files changed, 13 insertions(+), 14 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/syscare-common/src/ffi/os_str.rs b/syscare-common/src/ffi/os_str.rs
|
||
|
|
index 375ef82..0c414e1 100644
|
||
|
|
--- a/syscare-common/src/ffi/os_str.rs
|
||
|
|
+++ b/syscare-common/src/ffi/os_str.rs
|
||
|
|
@@ -119,7 +119,7 @@ pub trait OsStrExt: AsRef<OsStr> {
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
- fn split<'a, P: Pattern<'a>>(&'a self, pat: P) -> Split<P> {
|
||
|
|
+ fn split<'a, P: Pattern<'a>>(&'a self, pat: P) -> Split<'a, P> {
|
||
|
|
let haystack = self.as_ref().as_bytes();
|
||
|
|
|
||
|
|
Split(SplitImpl {
|
||
|
|
diff --git a/syscare-common/src/fs/fs_impl.rs b/syscare-common/src/fs/fs_impl.rs
|
||
|
|
index 23f8493..30c11b7 100644
|
||
|
|
--- a/syscare-common/src/fs/fs_impl.rs
|
||
|
|
+++ b/syscare-common/src/fs/fs_impl.rs
|
||
|
|
@@ -379,10 +379,10 @@ where
|
||
|
|
if !file_type.is_file() {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
- return file_path
|
||
|
|
+ file_path
|
||
|
|
.extension()
|
||
|
|
.map(|s| s == ext.as_ref())
|
||
|
|
- .unwrap_or(false);
|
||
|
|
+ .unwrap_or(false)
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
diff --git a/syscare-common/src/os_str/iter.rs b/syscare-common/src/os_str/iter.rs
|
||
|
|
index 2868c2e..e472d0c 100644
|
||
|
|
--- a/syscare-common/src/os_str/iter.rs
|
||
|
|
+++ b/syscare-common/src/os_str/iter.rs
|
||
|
|
@@ -165,7 +165,7 @@ impl<'a, P: Pattern<'a>> SplitImpl<'a, P> {
|
||
|
|
}
|
||
|
|
|
||
|
|
self.finished = true;
|
||
|
|
- return Some(OsStr::from_bytes(&haystack[self.position..]));
|
||
|
|
+ Some(OsStr::from_bytes(&haystack[self.position..]))
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
diff --git a/syscare-common/src/process/stdio.rs b/syscare-common/src/process/stdio.rs
|
||
|
|
index 450019a..9a93e56 100644
|
||
|
|
--- a/syscare-common/src/process/stdio.rs
|
||
|
|
+++ b/syscare-common/src/process/stdio.rs
|
||
|
|
@@ -160,10 +160,10 @@ impl Stdio {
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
- if stdout_buf.ends_with(&[b'\n']) {
|
||
|
|
+ if stdout_buf.ends_with(b"\n") {
|
||
|
|
stdout_buf.pop();
|
||
|
|
}
|
||
|
|
- if stderr_buf.ends_with(&[b'\n']) {
|
||
|
|
+ if stderr_buf.ends_with(b"\n") {
|
||
|
|
stderr_buf.pop();
|
||
|
|
}
|
||
|
|
|
||
|
|
diff --git a/syscared/src/args.rs b/syscared/src/args.rs
|
||
|
|
index 4c28dff..f98b54b 100644
|
||
|
|
--- a/syscared/src/args.rs
|
||
|
|
+++ b/syscared/src/args.rs
|
||
|
|
@@ -37,7 +37,6 @@ const DEFAULT_LOG_LEVEL: &str = "info";
|
||
|
|
global_setting(AppSettings::DeriveDisplayOrder),
|
||
|
|
term_width(120),
|
||
|
|
)]
|
||
|
|
-
|
||
|
|
pub struct Arguments {
|
||
|
|
/// Run as a daemon
|
||
|
|
#[clap(short, long)]
|
||
|
|
diff --git a/syscared/src/patch/resolver/kpatch.rs b/syscared/src/patch/resolver/kpatch.rs
|
||
|
|
index 85ec18e..863f65b 100644
|
||
|
|
--- a/syscared/src/patch/resolver/kpatch.rs
|
||
|
|
+++ b/syscared/src/patch/resolver/kpatch.rs
|
||
|
|
@@ -86,7 +86,7 @@ mod ffi {
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
- impl<'data, 'file, Elf: FileHeader> Iterator for KpatchRelocationIterator<'data, 'file, Elf> {
|
||
|
|
+ impl<Elf: FileHeader> Iterator for KpatchRelocationIterator<'_, '_, Elf> {
|
||
|
|
type Item = KpatchRelocation;
|
||
|
|
|
||
|
|
fn next(&mut self) -> Option<Self::Item> {
|
||
|
|
diff --git a/syscared/src/patch/resolver/upatch.rs b/syscared/src/patch/resolver/upatch.rs
|
||
|
|
index e8c2f2c..e49dff9 100644
|
||
|
|
--- a/syscared/src/patch/resolver/upatch.rs
|
||
|
|
+++ b/syscared/src/patch/resolver/upatch.rs
|
||
|
|
@@ -73,7 +73,7 @@ mod ffi {
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
- impl<'data, 'file, Elf: FileHeader> Iterator for UpatchRelocationIterator<'data, 'file, Elf> {
|
||
|
|
+ impl<Elf: FileHeader> Iterator for UpatchRelocationIterator<'_, '_, Elf> {
|
||
|
|
type Item = UpatchRelocation;
|
||
|
|
|
||
|
|
fn next(&mut self) -> Option<Self::Item> {
|
||
|
|
diff --git a/upatch-build/src/dwarf/mod.rs b/upatch-build/src/dwarf/mod.rs
|
||
|
|
index 0c172c5..4399b51 100644
|
||
|
|
--- a/upatch-build/src/dwarf/mod.rs
|
||
|
|
+++ b/upatch-build/src/dwarf/mod.rs
|
||
|
|
@@ -233,13 +233,13 @@ impl Dwarf {
|
||
|
|
while let Some(attr) = attrs.next()? {
|
||
|
|
match attr.name() {
|
||
|
|
constants::DW_AT_comp_dir => {
|
||
|
|
- element.compile_dir.push(&Self::attr_value(&attr, dwarf));
|
||
|
|
+ element.compile_dir.push(Self::attr_value(&attr, dwarf));
|
||
|
|
}
|
||
|
|
constants::DW_AT_name => {
|
||
|
|
- element.file_name.push(&Self::attr_value(&attr, dwarf));
|
||
|
|
+ element.file_name.push(Self::attr_value(&attr, dwarf));
|
||
|
|
}
|
||
|
|
constants::DW_AT_producer => {
|
||
|
|
- element.producer.push(&Self::attr_value(&attr, dwarf));
|
||
|
|
+ element.producer.push(Self::attr_value(&attr, dwarf));
|
||
|
|
}
|
||
|
|
_ => continue,
|
||
|
|
}
|
||
|
|
diff --git a/upatch-build/src/dwarf/relocate.rs b/upatch-build/src/dwarf/relocate.rs
|
||
|
|
index e8c7cdf..a6e8fb9 100644
|
||
|
|
--- a/upatch-build/src/dwarf/relocate.rs
|
||
|
|
+++ b/upatch-build/src/dwarf/relocate.rs
|
||
|
|
@@ -25,7 +25,7 @@ pub struct Relocate<'a, R: gimli::Reader<Offset = usize>> {
|
||
|
|
pub reader: R,
|
||
|
|
}
|
||
|
|
|
||
|
|
-impl<'a, R: gimli::Reader<Offset = usize>> Relocate<'a, R> {
|
||
|
|
+impl<R: gimli::Reader<Offset = usize>> Relocate<'_, R> {
|
||
|
|
pub fn relocate(&self, offset: usize, value: u64) -> u64 {
|
||
|
|
if let Some(relocation) = self.relocations.get(&offset) {
|
||
|
|
if relocation.kind() == object::RelocationKind::Absolute {
|
||
|
|
@@ -41,7 +41,7 @@ impl<'a, R: gimli::Reader<Offset = usize>> Relocate<'a, R> {
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
-impl<'a, R: gimli::Reader<Offset = usize>> gimli::Reader for Relocate<'a, R> {
|
||
|
|
+impl<R: gimli::Reader<Offset = usize>> gimli::Reader for Relocate<'_, R> {
|
||
|
|
type Endian = R::Endian;
|
||
|
|
type Offset = R::Offset;
|
||
|
|
|
||
|
|
--
|
||
|
|
2.34.1
|
||
|
|
|