Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address clippy lints #27

Merged
merged 3 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 31 additions & 18 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ jobs:
name: Check source
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
with:
name: coliasgroup
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- uses: actions/checkout@v3
- name: Check source
run: make check-source
check-dependencies:
name: Check dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
with:
name: coliasgroup
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- uses: actions/checkout@v3
- name: Check dependencies
run: make check-dependencies
run-sel4test:
Expand All @@ -42,57 +42,81 @@ jobs:
matrix:
arch: [aarch64, aarch32, riscv64, riscv32, x86_64, ia32]
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
with:
name: coliasgroup
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- uses: actions/checkout@v3
- name: Build and check
run: make run-sel4test-for SEL4TEST_ARCH=${{ matrix.arch }}
run-other-tests:
name: Run other tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Prepare to maximize build space
run: sudo mkdir /nix
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
build-mount-path: /nix
root-reserve-mb: 8192
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
with:
name: coliasgroup
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- uses: actions/checkout@v3
- name: Run tests
run: make run-fast-tests
build-docs:
name: Build docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
with:
name: coliasgroup
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- uses: actions/checkout@v3
- name: Build docs
run: make html-links
build-everything:
name: Build everything
runs-on: ubuntu-latest
needs: [check-source, run-sel4test, run-other-tests, build-docs]
steps:
- uses: actions/checkout@v3
- name: Prepare to maximize build space
run: sudo mkdir /nix
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
build-mount-path: /nix
root-reserve-mb: 8192
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: cachix/cachix-action@v12
with:
name: coliasgroup
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- uses: actions/checkout@v3
- name: Build everything
run: make everything
- name: Expose docs
Expand Down Expand Up @@ -122,18 +146,7 @@ jobs:
#
# May be necessary in the future:
#
# - name: Prepare to maximize build space
# run: sudo mkdir /nix
# - name: Maximize build space
# uses: easimon/maximize-build-space@master
# with:
# build-mount-path: /nix
# root-reserve-mb: 8192
# remove-dotnet: 'true'
# remove-android: 'true'
# remove-haskell: 'true'
# remove-codeql: 'true'
# remove-docker-images: 'true'

#
# For debugging and monitoring disk usage:
# (make foo && df -h) || (df -h && false)
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