Skip to content

Commit 4a96fe6

Browse files
misc: clippy :^)
Signed-off-by: Anhad Singh <[email protected]>
1 parent a5503a5 commit 4a96fe6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+432
-492
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@
1616
"termios.h": "c",
1717
"termios-c_iflag.h": "c"
1818
},
19+
"rust-analyzer.check.command": "clippy",
1920
}

src/aero_kernel/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ fn main() -> Result<(), Box<dyn Error>> {
7373
inc_files = inc_files
7474
.iter()
7575
.map(|e| {
76-
let e = e.split("/").collect::<Vec<_>>();
77-
e[..e.len() - 1].join("/").to_string()
76+
let e = e.split('/').collect::<Vec<_>>();
77+
e[..e.len() - 1].join("/")
7878
})
7979
.collect::<Vec<_>>();
8080

src/aero_kernel/src/acpi/hpet.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ pub(super) struct Hpet {
3636

3737
impl Hpet {
3838
pub fn new(sdt: &'static Sdt) -> Self {
39-
let this = unsafe { ptr::read((sdt as *const Sdt) as *const Self) };
40-
41-
this
39+
unsafe { ptr::read((sdt as *const Sdt) as *const Self) }
4240
}
4341
}

src/aero_kernel/src/acpi/rsdp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,14 @@ pub(super) fn find_rsdt_address(rsdp_address: VirtAddr) -> RsdtAddress {
199199
assert!(valid, "rsdp: failed to validate RSDP v20 checksum");
200200

201201
let xsdt_address = PhysAddr::new(v20.xsdt_address).as_hhdm_virt();
202-
return RsdtAddress::Xsdt(xsdt_address);
202+
RsdtAddress::Xsdt(xsdt_address)
203203
} else {
204204
let v10 = unsafe { &*(rsdp_address.as_ptr() as *const Rsdp10) };
205205
let valid = validate_rsdt_checksum(v10);
206206

207207
assert!(valid, "rsdp: failed to validate RSDP v10 checksum");
208208

209209
let rsdt_address = PhysAddr::new(v10.rsdt_address as u64).as_hhdm_virt();
210-
return RsdtAddress::Rsdt(rsdt_address);
210+
RsdtAddress::Rsdt(rsdt_address)
211211
}
212212
}

src/aero_kernel/src/arch/x86_64/apic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ pub fn io_apic_set_redirect(vec: u8, gsi: u32, flags: u16, status: i32) {
404404
let ioredtbl = (gsi - entry.global_system_interrupt_base) * 2 + 16;
405405

406406
unsafe {
407-
io_apic_write(io_apic, ioredtbl + 0, redirect as _);
407+
io_apic_write(io_apic, ioredtbl, redirect as _);
408408
io_apic_write(io_apic, ioredtbl + 1, (redirect as u64 >> 32) as _);
409409
}
410410

@@ -468,5 +468,5 @@ pub fn init() -> ApicType {
468468
INTERRUPT_CONTROLLER.switch_to_apic();
469469
}
470470

471-
return apic_type;
471+
apic_type
472472
}

src/aero_kernel/src/arch/x86_64/interrupts/exceptions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub fn breakpoint(stack: &mut InterruptErrorStack) {
116116
//
117117
// So we will set the RIP to RIP - 1, pointing to the int3
118118
// instruction.
119-
(*stack).stack.iret.rip -= 1;
119+
stack.stack.iret.rip -= 1;
120120
}
121121

122122
pub(super) fn page_fault(stack: &mut InterruptErrorStack) {

src/aero_kernel/src/arch/x86_64/interrupts/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ pub fn allocate_vector() -> u8 {
259259
static IDT_FREE_VECTOR: Mutex<u8> = Mutex::new(32);
260260

261261
let mut fvector = IDT_FREE_VECTOR.lock();
262-
let fcopy = fvector.clone();
262+
let fcopy = *fvector;
263263

264264
if fcopy == 0xf0 {
265265
panic!("allocate_vector: vector allocation exhausted")

src/aero_kernel/src/arch/x86_64/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ extern "C" fn arch_aero_main() -> ! {
165165
.first()
166166
.expect("limine: no framebuffer found!");
167167

168-
rendy::init(&*framebuffer, &command_line);
168+
rendy::init(framebuffer, &command_line);
169169
logger::set_rendy_debug(true);
170170

171171
interrupts::init();

src/aero_kernel/src/arch/x86_64/task.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ impl ArchTask {
240240
user: true,
241241

242242
// The FS and GS bases are inherited from the parent process.
243-
fs_base: self.fs_base.clone(),
244-
gs_base: self.gs_base.clone(),
243+
fs_base: self.fs_base,
244+
gs_base: self.gs_base,
245245

246246
fpu_storage: Some(fpu_storage),
247247
})
@@ -296,8 +296,8 @@ impl ArchTask {
296296
user: true,
297297

298298
// The FS and GS bases are inherited from the parent process.
299-
fs_base: self.fs_base.clone(),
300-
gs_base: self.gs_base.clone(),
299+
fs_base: self.fs_base,
300+
gs_base: self.gs_base,
301301

302302
fpu_storage: Some(fpu_storage),
303303
})

src/aero_kernel/src/arch/x86_64/tls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,6 @@ where
175175
let lock = CPU_INFO.lock();
176176

177177
for info in lock.iter() {
178-
f(&info);
178+
f(info);
179179
}
180180
}

0 commit comments

Comments
 (0)