Commit 09f0489f authored by Jens Breitbart's avatar Jens Breitbart
Browse files

Fixed some simple Clippy warnings

parent 755c11e4
......@@ -106,9 +106,9 @@ macro_rules! write_u32 {
impl VirtioNetPciDevice {
pub const fn new() -> VirtioNetPciDevice {
let mut registers: PciRegisters = [0; 0x40];
write_u16!(registers, VENDOR_ID_REGISTER, 0x1AF4 as u16);
write_u16!(registers, DEVICE_ID_REGISTER, 0x1000 as u16);
write_u16!(registers, CLASS_REGISTER + 2, 0x0200 as u16);
write_u16!(registers, VENDOR_ID_REGISTER, 0x1AF4);
write_u16!(registers, DEVICE_ID_REGISTER, 0x1000);
write_u16!(registers, CLASS_REGISTER + 2, 0x0200);
write_u16!(registers, BAR0_REGISTER, IOBASE as u16);
registers[STATUS_REGISTER as usize] = STATUS_DRIVER_NEEDS_RESET;
let virt_queues: Vec<Virtqueue> = Vec::new();
......
......@@ -10,12 +10,12 @@ pub fn parse_mem(mem: &str) -> Result<usize> {
let num = num.parse::<usize>().map_err(|_| Error::ParseMemory)?;
let factor = match postfix.as_str() {
"E" | "e" => 1 << 60 as usize,
"P" | "p" => 1 << 50 as usize,
"T" | "t" => 1 << 40 as usize,
"G" | "g" => 1 << 30 as usize,
"M" | "m" => 1 << 20 as usize,
"K" | "k" => 1 << 10 as usize,
"E" | "e" => 1 << 60,
"P" | "p" => 1 << 50,
"T" | "t" => 1 << 40,
"G" | "g" => 1 << 30,
"M" | "m" => 1 << 20,
"K" | "k" => 1 << 10,
_ => return Err(Error::ParseMemory),
};
......@@ -152,18 +152,19 @@ pub fn parse_cpu_affinity(args: Vec<&str>) -> Result<Vec<u32>> {
// res is Err if any single parse_u32_range(s) returned Err
let parsed_affinity: Result<Vec<Vec<u32>>> =
args.into_iter().map(|s| parse_u32_range(s)).collect();
if parsed_affinity.is_err() {
return Err(parsed_affinity.unwrap_err());
} else {
// Merge Vec of Vecs into single Vector affinity
for vec in parsed_affinity.unwrap().into_iter() {
affinity.extend(vec);
}
match parsed_affinity {
Err(e) => Err(e),
affinity.sort();
affinity.dedup();
let affinity = affinity;
Ok(affinity)
Ok(v) => {
for vec in v {
affinity.extend(vec);
}
affinity.sort_unstable();
affinity.dedup();
let affinity = affinity;
Ok(affinity)
}
}
}
......
......@@ -536,7 +536,7 @@ pub trait Vm {
let elf =
elf::Elf::parse(&buffer).map_err(|_| Error::InvalidFile(self.kernel_path().into()))?;
if elf.libraries.len() > 0 {
if !elf.libraries.is_empty() {
warn!(
"Error: file depends on following libraries: {:?}",
elf.libraries
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment