Skip to content

Commit

Permalink
Address clippy lints
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Spinale <nick@nickspinale.com>
  • Loading branch information
nspin committed Oct 3, 2023
1 parent 2c3720d commit b9c877a
Show file tree
Hide file tree
Showing 18 changed files with 27 additions and 10 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl Handler for HandlerImpl {
CLIENT => match msg_info.recv_using_postcard::<Request>() {
Ok(req) => match req {
Request::GetNumBlocks => {
let num_blocks = self.dev.capacity().try_into().unwrap();
let num_blocks = self.dev.capacity();
MessageInfo::send_using_postcard(GetNumBlocksResponse { num_blocks })
.unwrap()
}
Expand Down
1 change: 1 addition & 0 deletions crates/private/meta/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ sel4-async-network = { path = "../../sel4-async/network" }
sel4-async-request-statuses = { path = "../../sel4-async/request-statuses" }
sel4-async-single-threaded-executor = { path = "../../sel4-async/single-threaded-executor" }
sel4-async-timers = { path = "../../sel4-async/timers" }
sel4-async-unsync = { path = "../../sel4-async/unsync" }
sel4-bounce-buffer-allocator = { path = "../../sel4-bounce-buffer-allocator" }
sel4-config = { path = "../../sel4/config" }
sel4-immediate-sync-once-cell = { path = "../../sel4-immediate-sync-once-cell" }
Expand Down
1 change: 1 addition & 0 deletions crates/private/meta/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ definitely! {
sel4_async_request_statuses
sel4_async_single_threaded_executor
sel4_async_timers
sel4_async_unsync
sel4_bounce_buffer_allocator
sel4_config
sel4_externally_shared
Expand Down
1 change: 1 addition & 0 deletions crates/sel4-async/block-io/fat/src/dummy_time_source.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pub use embedded_fat as fat;

#[derive(Default)]
pub struct DummyTimeSource(());

impl DummyTimeSource {
Expand Down
4 changes: 2 additions & 2 deletions crates/sel4-async/unsync/src/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ impl<T> Deref for Guard<'_, T> {
type Target = T;

fn deref(&self) -> &Self::Target {
&*self.ref_mut
&self.ref_mut
}
}

impl<T> DerefMut for Guard<'_, T> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut *self.ref_mut
&mut self.ref_mut
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ fn with_bit_width<T: FileHeaderExt<Word: PrimInt, Sword: PrimInt>>(
input
.concrete_patches
.push(("embedded_debug_info_size".to_owned(), content_len));
input.render_with_data(&image_elf).unwrap()
input.render_with_data(image_elf).unwrap()
}
1 change: 1 addition & 0 deletions crates/sel4-kernel-loader/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(int_roundings)]
#![allow(clippy::useless_conversion)]

use std::env;
use std::fs;
Expand Down
4 changes: 2 additions & 2 deletions crates/sel4-kernel-loader/embed-page-tables/src/embed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl Embedding {
}
}

fn embed<'a, T: Scheme>(mut self, table: &'a Table<T>) -> TokenStream {
fn embed<T: Scheme>(mut self, table: &Table<T>) -> TokenStream {
let _ = self.embed_inner(table);
self.check_tables_order();
let runtime_mod_ident = self.runtime_mod_ident;
Expand All @@ -82,7 +82,7 @@ impl Embedding {
});
}

fn embed_inner<'a, T: Scheme>(&mut self, table: &'a Table<T>) -> usize {
fn embed_inner<T: Scheme>(&mut self, table: &Table<T>) -> usize {
let index = self.allocate_index();
let entries = table.entries.iter().map(|entry| {
let entry = EntryForEmbedding::<T>::from_abstract_entry(entry);
Expand Down
6 changes: 3 additions & 3 deletions crates/sel4-kernel-loader/embed-page-tables/src/regions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl<T> AbstractRegion<T> {
Self { range, content }
}

fn to_arc(self) -> AbstractRegion<Arc<T>> {
fn into_arc(self) -> AbstractRegion<Arc<T>> {
AbstractRegion {
range: self.range,
content: Arc::new(self.content),
Expand All @@ -33,7 +33,7 @@ pub struct AbstractRegions<T> {
impl<T> AbstractRegionsBuilder<T> {
pub fn new_with_background(background: AbstractRegion<T>) -> Self {
Self {
regions: vec![background.to_arc()],
regions: vec![background.into_arc()],
}
}

Expand Down Expand Up @@ -67,7 +67,7 @@ impl<T> AbstractRegionsBuilder<T> {
let new_regions = regions[..i_left]
.iter()
.chain(
[left, region.to_arc(), right]
[left, region.into_arc(), right]
.iter()
.filter(|r| r.range.start < r.range.end),
)
Expand Down
2 changes: 1 addition & 1 deletion crates/sel4-kernel-loader/embed-page-tables/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ where
}

fn current_content(&self) -> Option<&RegionContent<T>> {
(&*self.current().content).as_ref()
(*self.current().content).as_ref()
}

fn advance(&mut self) -> bool {
Expand Down
2 changes: 2 additions & 0 deletions crates/sel4-kernel-loader/payload-types/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#![no_std]
#![feature(strict_provenance)]
#![deny(unsafe_op_in_unsafe_fn)]
#![allow(clippy::useless_conversion)]

use core::ops::Range;
use core::ptr;
Expand Down Expand Up @@ -117,6 +118,7 @@ impl<'a> RegionContent for DirectRegionContent<'a> {
}

impl<U: RegionContent, const N: usize> Payload<usize, U, N> {
#[allow(clippy::missing_safety_doc)]
pub unsafe fn copy_data_out(&self, region_content_source: &U::Source) {
for region in self.data.iter() {
let dst = unsafe {
Expand Down
1 change: 1 addition & 0 deletions crates/sel4-kernel-loader/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#![feature(stdsimd)]
#![allow(dead_code)]
#![allow(unreachable_code)]
#![allow(clippy::reversed_empty_ranges)]

use spin::RwLock;

Expand Down
1 change: 1 addition & 0 deletions crates/sel4-shared-ring-buffer/block-io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![feature(async_fn_in_trait)]
#![feature(never_type)]
#![feature(strict_provenance)]
#![allow(clippy::useless_conversion)]

extern crate alloc;

Expand Down
2 changes: 2 additions & 0 deletions crates/sel4/src/bootinfo.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::useless_conversion)]

use core::mem;
use core::ops::Range;
use core::slice;
Expand Down
2 changes: 2 additions & 0 deletions crates/sel4/src/invocations.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(clippy::useless_conversion)]

use core::mem;

use sel4_config::{sel4_cfg, sel4_cfg_if};
Expand Down
3 changes: 3 additions & 0 deletions crates/sel4/sys/build/xml/invocations/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#![allow(clippy::eq_op)]
#![allow(clippy::nonminimal_bool)]

use std::collections::BTreeMap;
use std::fmt::Write;
use std::ops::Range;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ mk {
sel4-async-request-statuses
sel4-async-single-threaded-executor
sel4-async-timers
sel4-async-unsync
sel4-bounce-buffer-allocator
sel4-externally-shared
sel4-immediate-sync-once-cell
Expand Down

0 comments on commit b9c877a

Please sign in to comment.