Skip to content

Fix all clippy warnings and run CI for all workspace packages #242

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
16 changes: 6 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ jobs:

clippy:
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-Dwarnings"
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -79,14 +81,8 @@ jobs:
profile: minimal
components: clippy

- name: Run clippy (ACPI)
run: cargo clippy -p acpi

- name: Run clippy (ACPI tests)
run: cargo clippy -p acpi --tests

- name: Run clippy (AML)
run: cargo clippy -p aml
- name: Run clippy
run: cargo clippy --all

- name: Run clippy (AML tests)
run: cargo clippy -p aml --tests
- name: Run clippy (tests)
run: cargo clippy --all --tests
6 changes: 3 additions & 3 deletions aml/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ impl AmlValue {
*/
let bits_to_copy = cmp::min(length, 64);
bitslice[offset..(offset + bits_to_copy)]
.copy_from_bitslice(&value.to_le_bytes().view_bits()[..(bits_to_copy as usize)]);
.copy_from_bitslice(&value.to_le_bytes().view_bits()[..(bits_to_copy)]);
// Zero extend to the end of the buffer field
bitslice[(offset + bits_to_copy)..(offset + length)].fill(false);
Ok(())
Expand All @@ -514,7 +514,7 @@ impl AmlValue {
let value_data = value.lock();
let bits_to_copy = cmp::min(length, value_data.len() * 8);
bitslice[offset..(offset + bits_to_copy)]
.copy_from_bitslice(&value_data.view_bits()[..(bits_to_copy as usize)]);
.copy_from_bitslice(&value_data.view_bits()[..(bits_to_copy)]);
// Zero extend to the end of the buffer field
bitslice[(offset + bits_to_copy)..(offset + length)].fill(false);
Ok(())
Expand Down Expand Up @@ -560,7 +560,7 @@ impl Args {
}

let mut args: Vec<Option<AmlValue>> = list.into_iter().map(Option::Some).collect();
args.extend(core::iter::repeat(None).take(7 - args.len()));
args.extend(core::iter::repeat_n(None, 7 - args.len()));
Ok(Args(args.try_into().unwrap()))
}

Expand Down
17 changes: 10 additions & 7 deletions aml_tester/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use aml::{AmlContext, DebugVerbosity};
use clap::{Arg, ArgAction, ArgGroup};
use std::{
cell::RefCell,
collections::{HashMap, HashSet},
collections::HashSet,
ffi::OsStr,
fs::{self, File},
io::{Read, Write},
Expand Down Expand Up @@ -55,8 +55,8 @@ fn main() -> std::io::Result<()> {
println!("Running tests in directory: {:?}", dir_path);
fs::read_dir(dir_path)?
.filter_map(|entry| {
if entry.is_ok() {
Some(entry.unwrap().path().to_string_lossy().to_string())
if let Ok(entry) = entry {
Some(entry.path().to_string_lossy().to_string())
} else {
None
}
Expand All @@ -67,15 +67,18 @@ fn main() -> std::io::Result<()> {
};

// Make sure all files exist, propagate error if it occurs
files.iter().fold(Ok(()), |result: std::io::Result<()>, file| {
let mut result = Ok(());
for file in files.iter() {
let path = Path::new(file);
if !path.is_file() {
println!("Not a regular file: {}", file);
// Get the io error if there is one
path.metadata()?;
if let Err(e) = path.metadata() {
result = Err(e);
}
}
result
})?;
}
result?;

// Make sure we have the ability to compile ASL -> AML, if user wants it
let user_wants_compile = !matches.get_flag("no_compile");
Expand Down
4 changes: 4 additions & 0 deletions rsdp/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ where
/// than `region_length`, due to requirements of the paging system or other reasoning.
/// - `handler` should be the same `AcpiHandler` that created the mapping. When the `PhysicalMapping` is
/// dropped, it will be used to unmap the structure.
///
/// # Safety
///
/// The caller must make sure that the parameters correctly represent an existing mapping.
pub unsafe fn new(
physical_start: usize,
virtual_start: NonNull<T>,
Expand Down
Loading