Skip to content

Commit

Permalink
clippy is happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Samir-Rashid committed Oct 1, 2024
1 parent be5b65c commit b203190
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 8 deletions.
1 change: 0 additions & 1 deletion arch/rv32i/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#![crate_name = "rv32i"]
#![crate_type = "rlib"]
#![no_std]
use flux_rs::*;

use core::fmt::Write;

Expand Down
2 changes: 0 additions & 2 deletions arch/rv32i/src/support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
//! Core low-level operations.

use crate::csr::{mstatus::mstatus, CSR};
use flux_rs::*;
use flux_support::*;

#[cfg(all(target_arch = "riscv32", target_os = "none"))]
#[inline(always)]
Expand Down
1 change: 0 additions & 1 deletion arch/rv32i/src/syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use core::mem::size_of;
use core::ops::Range;

use crate::csr::mcause;
use flux_rs::*;
use flux_support::*;
use kernel::errorcode::ErrorCode;
use kernel::syscall::ContextSwitchReason;
Expand Down
14 changes: 11 additions & 3 deletions flux_support/src/flux_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use flux_rs::{refined_by, sig};
use std::ops::Rem;

#[flux_rs::opaque]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Ord)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[refined_by(ptr: int)]
pub struct FluxPtr {
inner: *mut u8,
Expand Down Expand Up @@ -55,6 +55,12 @@ impl core::ops::AddAssign<usize> for FluxPtr {
}
}

impl core::cmp::Ord for FluxPtr {
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
self.as_usize().cmp(&other.as_usize())
}
}

// VTOCK-TODO: fill in these functions with obvious implementations
impl FluxPtr {
#[sig(fn(self: Self[@lhs], rhs: usize) -> Self{r: ((lhs + rhs <= usize::MAX) => r == lhs + rhs) && ((lhs + rhs > usize::MAX) => r == lhs + rhs - usize::MAX) })]
Expand Down Expand Up @@ -96,10 +102,12 @@ impl FluxPtr {
unimplemented!()
}

/// # Safety
pub const unsafe fn offset(self, _count: isize) -> Self {
unimplemented!()
}

/// # Safety
pub const unsafe fn add(self, _count: usize) -> Self {
unimplemented!()
}
Expand All @@ -111,8 +119,8 @@ impl FluxPtr {

#[flux_rs::trusted]
impl PartialOrd for FluxPtr {
fn partial_cmp(&self, _other: &Self) -> Option<core::cmp::Ordering> {
todo!()
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
Some(self.cmp(other))
}

// Provided methods
Expand Down
1 change: 1 addition & 0 deletions kernel/src/grant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ use crate::processbuffer::{ReadOnlyProcessBuffer, ReadWriteProcessBuffer};
use crate::processbuffer::{ReadOnlyProcessBufferRef, ReadWriteProcessBufferRef};
use crate::upcall::{Upcall, UpcallError, UpcallId};
use crate::ErrorCode;
#[allow(clippy::wildcard_imports)]
use flux_support::*;

/// Tracks how many upcalls a grant instance supports automatically.
Expand Down
1 change: 1 addition & 0 deletions kernel/src/hil/can.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
//!

use crate::ErrorCode;
#[allow(clippy::wildcard_imports)]
use flux_support::*;

pub const STANDARD_CAN_PACKET_SIZE: usize = 8;
Expand Down
1 change: 1 addition & 0 deletions kernel/src/kernel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use crate::syscall::{Syscall, YieldCall};
use crate::syscall_driver::CommandReturn;
use crate::upcall::{Upcall, UpcallId};
use crate::utilities::cells::NumericCellExt;
#[allow(clippy::wildcard_imports)]
use flux_support::*;

/// Threshold in microseconds to consider a process's timeslice to be exhausted.
Expand Down
1 change: 1 addition & 0 deletions kernel/src/memop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use crate::process::Process;
use crate::syscall::SyscallReturn;
use crate::ErrorCode;
#[allow(clippy::wildcard_imports)]
use flux_support::*;

/// Handle the `memop` syscall.
Expand Down
1 change: 1 addition & 0 deletions kernel/src/platform/mpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use core::cmp;
use core::fmt::{self, Display};
#[allow(clippy::wildcard_imports)]
use flux_support::*;

/// User mode access permissions.
Expand Down
1 change: 1 addition & 0 deletions kernel/src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use crate::processbuffer::{ReadOnlyProcessBuffer, ReadWriteProcessBuffer};
use crate::storage_permissions;
use crate::syscall::{self, Syscall, SyscallReturn};
use crate::upcall::UpcallId;
#[allow(clippy::wildcard_imports)]
use flux_support::*;
use tock_tbf::types::CommandPermissions;

Expand Down
1 change: 1 addition & 0 deletions kernel/src/process_binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::config;
use crate::debug;
use crate::process_checker::AcceptedCredential;
use crate::utilities::cells::OptionalCell;
#[allow(clippy::wildcard_imports)]
use flux_support::*;

/// Errors resulting from trying to load a process binary structure from flash.
Expand Down
1 change: 1 addition & 0 deletions kernel/src/process_loading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use crate::process_checker::{AppIdPolicy, ProcessCheckError, ProcessCheckerMachi
use crate::process_policies::ProcessFaultPolicy;
use crate::process_standard::ProcessStandard;
use crate::utilities::cells::{MapCell, OptionalCell};
#[allow(clippy::wildcard_imports)]
use flux_support::*;

/// Errors that can occur when trying to load and create processes.
Expand Down
3 changes: 2 additions & 1 deletion kernel/src/process_standard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use core::fmt::Write;
use core::num::NonZeroU32;
use core::ptr::NonNull;
use core::{mem, slice, str};
#[allow(clippy::wildcard_imports)]
use flux_support::*;

use crate::collections::queue::Queue;
Expand Down Expand Up @@ -2155,7 +2156,7 @@ impl<C: 'static + Chip> ProcessStandard<'_, C> {

/// The lowest address of the grant region for the process.
fn kernel_memory_break(&self) -> FluxPtrU8Mut {
self.breaks.get().app_break
self.breaks.get().kernel_memory_break
}

/// Return the highest address the process has access to, or the current
Expand Down
1 change: 1 addition & 0 deletions kernel/src/processbuffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use crate::ErrorCode;
use core::cell::Cell;
use core::marker::PhantomData;
use core::ops::{Deref, Index, Range, RangeFrom, RangeTo};
#[allow(clippy::wildcard_imports)]
use flux_support::*;

/// Convert a process buffer's internal representation to a
Expand Down
1 change: 1 addition & 0 deletions kernel/src/syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ use core::fmt::Write;
use crate::errorcode::ErrorCode;
use crate::process;
pub use crate::syscall_driver::{CommandReturn, SyscallDriver};
#[allow(clippy::wildcard_imports)]
use flux_support::*;

/// Helper function to split a [`u64`] into a higher and lower [`u32`].
Expand Down
1 change: 1 addition & 0 deletions kernel/src/utilities/leasable_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
use core::ops::{Bound, RangeBounds};
use core::ops::{Index, IndexMut};
use core::slice::SliceIndex;
#[allow(clippy::wildcard_imports)]
use flux_support::*;

/// A mutable leasable buffer implementation.
Expand Down

0 comments on commit b203190

Please sign in to comment.