Add rust lint CI job. (#9)
All checks were successful
Check / Check Rust (push) Successful in 20s

Additionally fix the many lint errors that are occurring. (or disable them).

Reviewed-on: #9
Co-authored-by: Drew Galbraith <drew@tiramisu.one>
Co-committed-by: Drew Galbraith <drew@tiramisu.one>
This commit is contained in:
Drew 2025-12-14 09:02:59 +00:00 committed by Drew
parent 311755c812
commit 1a48911745
30 changed files with 177 additions and 108 deletions

View file

@ -95,7 +95,7 @@ impl Command {
command: SataCommand::DmaReadExt,
lba,
sector_cnt: lba_count,
paddr: paddr,
paddr,
memory_region: None,
}
}

View file

@ -44,9 +44,8 @@ impl PortController {
};
// This leaves space for 8 prdt entries.
for i in 0..32 {
command_list[i].command_table_base_addr =
(command_paddr + 0x500) + (0x100 * (i as u64));
for (i, header) in command_list.iter_mut().enumerate() {
header.command_table_base_addr = (command_paddr + 0x500) + (0x100 * (i as u64));
}
let command_slots = array::from_fn(|_| Arc::new(Mutex::new(CommandStatus::Empty)));

View file

@ -16,15 +16,16 @@ impl Framebuffer {
})
}
fn draw_pixel(&self, row: u32, col: u32, pixel: u32) {
fn draw_pixel(&mut self, row: u32, col: u32, pixel: u32) {
let index = row * (self.fb_info.pitch as u32 / 4) + col;
self.memory_region.mut_slice()[index as usize] = pixel;
}
pub fn draw_glyph(&self, glyph: &[u8], row: u32, col: u32) {
pub fn draw_glyph(&mut self, glyph: &[u8], row: u32, col: u32) {
let gl_width = 8;
let gl_height = 16;
#[allow(clippy::needless_range_loop)]
for r in 0..gl_height {
for c in 0..gl_width {
if ((glyph[r] >> c) % 2) == 1 {

View file

@ -23,7 +23,7 @@ pub struct Psf {
impl Psf {
pub fn new(path: &str) -> Result<Self, ZError> {
let file = File::open(&path)?;
let file = File::open(path)?;
let header = file.slice()[0..core::mem::size_of::<PsfHeader>()]
.as_ptr()

View file

@ -62,10 +62,8 @@ impl Terminal {
}
fn write_line(&mut self, line: &str) {
let mut col = 0;
for c in line.chars() {
self.console.write_char(c, self.row, col);
col += 1;
for (col, c) in line.chars().enumerate() {
self.console.write_char(c, self.row, col as u32);
}
self.row += 1

View file

@ -12,7 +12,8 @@ static mut VFS_CLIENT: Option<VFSClient> = None;
fn get_client() -> &'static mut VFSClient {
unsafe {
if let None = VFS_CLIENT {
#[allow(static_mut_refs)]
if VFS_CLIENT.is_none() {
let endpoint_cap = yellowstone_yunq::from_init_endpoint()
.get_endpoint(&yellowstone_yunq::GetEndpointRequest {
endpoint_name: "victoriafalls".to_string(),
@ -21,6 +22,7 @@ fn get_client() -> &'static mut VFSClient {
VFS_CLIENT = Some(VFSClient::new(Capability::take(endpoint_cap.endpoint)));
}
#[allow(static_mut_refs)]
VFS_CLIENT.as_mut().unwrap()
}
}

View file

@ -35,7 +35,7 @@ impl VFSServerHandler for VictoriaFallsServerImpl {
let mut inode_num = 2; // Start with root.
while let Some(path_token) = tokens.next() {
for path_token in tokens {
inode_num = self.find_path_in_dir(inode_num, path_token)?;
}
@ -57,7 +57,7 @@ impl VFSServerHandler for VictoriaFallsServerImpl {
let mut inode_num = 2; // Start with root.
while let Some(path_token) = tokens.next() {
for path_token in tokens {
inode_num = self.find_path_in_dir(inode_num, path_token)?;
}

View file

@ -57,9 +57,8 @@ impl YellowstoneServerContext {
pub fn wait(&self, service: &str) -> Result<(), ZError> {
loop {
match self.service_map.lock().get(service) {
Some(_) => return Ok(()),
None => {}
if self.service_map.lock().get(service).is_some() {
return Ok(());
}
self.registration_semaphore.wait().unwrap();
}