Skip to content

Commit 67cdf93

Browse files
committed
kernel: fix clippy warnings
Fix code to remove clippy warnings. Signed-off-by: Sergio Lopez <slp@redhat.com>
1 parent 9cb43c3 commit 67cdf93

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/kernel/src/cmdline/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ impl fmt::Display for Error {
4949
pub type Result<T> = result::Result<T, Error>;
5050

5151
fn valid_char(c: char) -> bool {
52-
match c {
53-
' '..='~' => true,
54-
_ => false,
55-
}
52+
matches!(c, ' '..='~')
5653
}
5754

5855
fn valid_str(s: &str) -> Result<()> {
@@ -164,7 +161,7 @@ impl Cmdline {
164161

165162
/// Returns the cmdline in progress as CString.
166163
pub fn as_cstring(&self) -> Result<CString> {
167-
Ok(CString::new(self.line.clone()).map_err(|_| Error::InvalidAscii)?)
164+
CString::new(self.line.clone()).map_err(|_| Error::InvalidAscii)
168165
}
169166
}
170167

src/kernel/src/loader/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl fmt::Display for Error {
4141
Error::InvalidProgramHeaderSize => "Invalid ELF program header size",
4242
Error::InvalidProgramHeaderOffset => "Invalid ELF program header offset",
4343
Error::InvalidProgramHeaderAddress => "Invalid ELF program header address",
44-
Error::ReadKernelDataStruct(ref e) => e,
44+
Error::ReadKernelDataStruct(e) => e,
4545
Error::ReadKernelImage => "Failed to write kernel image to guest memory",
4646
Error::SeekKernelStart => {
4747
"Failed to seek to file offset as pointed by the ELF program header"

0 commit comments

Comments
 (0)