diff --git a/components/patina_acpi/src/lib.rs b/components/patina_acpi/src/lib.rs index 65f9b0c4e..a0c46645c 100644 --- a/components/patina_acpi/src/lib.rs +++ b/components/patina_acpi/src/lib.rs @@ -37,6 +37,7 @@ //! #![cfg_attr(all(not(feature = "std"), not(test), not(feature = "mockall")), no_std)] +#![deny(missing_docs)] #![feature(coverage_attribute)] #![feature(allocator_api)] diff --git a/components/patina_adv_logger/src/lib.rs b/components/patina_adv_logger/src/lib.rs index 4821ba391..9c9f1745f 100644 --- a/components/patina_adv_logger/src/lib.rs +++ b/components/patina_adv_logger/src/lib.rs @@ -5,6 +5,7 @@ " SPDX-License-Identifier: Apache-2.0\n", )] #![cfg_attr(all(not(feature = "std"), not(doc)), no_std)] +#![deny(missing_docs)] #![feature(coverage_attribute)] #[cfg(any(feature = "alloc", test, doc))] diff --git a/components/patina_mm/src/lib.rs b/components/patina_mm/src/lib.rs index e90a80f09..2c53a115f 100644 --- a/components/patina_mm/src/lib.rs +++ b/components/patina_mm/src/lib.rs @@ -4,6 +4,7 @@ " Copyright (c) Microsoft Corporation.\n\n", )] #![cfg_attr(all(not(feature = "std"), not(test), not(feature = "mockall")), no_std)] +#![deny(missing_docs)] #![feature(coverage_attribute)] extern crate alloc; diff --git a/components/patina_mm/tests/patina_mm_integration.rs b/components/patina_mm/tests/patina_mm_integration.rs index a280aa414..9aae839c2 100644 --- a/components/patina_mm/tests/patina_mm_integration.rs +++ b/components/patina_mm/tests/patina_mm_integration.rs @@ -9,5 +9,5 @@ //! //! SPDX-License-Identifier: Apache-2.0 -#[path = "patina_mm_integration/mod.rs"] +#[path = "patina_mm_integration/tests_root.rs"] mod patina_mm_integration; diff --git a/components/patina_mm/tests/patina_mm_integration/mod.rs b/components/patina_mm/tests/patina_mm_integration/tests_root.rs similarity index 100% rename from components/patina_mm/tests/patina_mm_integration/mod.rs rename to components/patina_mm/tests/patina_mm_integration/tests_root.rs diff --git a/components/patina_performance/src/lib.rs b/components/patina_performance/src/lib.rs index 702796fe3..26d6d8a39 100644 --- a/components/patina_performance/src/lib.rs +++ b/components/patina_performance/src/lib.rs @@ -30,6 +30,7 @@ //! #![cfg_attr(not(test), no_std)] +#![deny(missing_docs)] #![allow(unexpected_cfgs)] #![feature(coverage_attribute)] diff --git a/components/patina_samples/src/lib.rs b/components/patina_samples/src/lib.rs index 6fedf2663..7c99f3168 100644 --- a/components/patina_samples/src/lib.rs +++ b/components/patina_samples/src/lib.rs @@ -16,6 +16,7 @@ //! SPDX-License-Identifier: Apache-2.0 //! #![cfg_attr(not(feature = "std"), no_std)] +#![deny(missing_docs)] #![feature(coverage_attribute)] #![coverage(off)] // Disable all coverage instrumentation for sample code pub mod component; diff --git a/components/patina_smbios/src/lib.rs b/components/patina_smbios/src/lib.rs index 368d99a37..aaa130548 100644 --- a/components/patina_smbios/src/lib.rs +++ b/components/patina_smbios/src/lib.rs @@ -310,6 +310,7 @@ //! SPDX-License-Identifier: Apache-2.0 #![cfg_attr(all(not(feature = "std"), not(test), not(feature = "mockall")), no_std)] +#![deny(missing_docs)] #![feature(coverage_attribute)] // SMBIOS tables require little-endian byte order. The SmbiosRecord derive macro diff --git a/components/patina_test/src/lib.rs b/components/patina_test/src/lib.rs index 214c6ab1f..ad16e356a 100644 --- a/components/patina_test/src/lib.rs +++ b/components/patina_test/src/lib.rs @@ -4,6 +4,7 @@ " Copyright (c) Microsoft Corporation.\n\n", )] #![no_std] +#![deny(missing_docs)] #![feature(coverage_attribute)] extern crate alloc; diff --git a/core/patina_internal_collections/src/rbt.rs b/core/patina_internal_collections/src/rbt.rs index 0b09861ab..2001b1431 100644 --- a/core/patina_internal_collections/src/rbt.rs +++ b/core/patina_internal_collections/src/rbt.rs @@ -803,7 +803,7 @@ where if node_is_left_child && sibling.right().is_black() { sibling.left().set_black(); sibling.set_red(); - if let Some(subtree_root) = Self::rotate_right(sibling.unwrap()) + if let Some(subtree_root) = Self::rotate_right(sibling.expect("sibling must exist in case 5")) && subtree_root.parent().is_none() { root.set(subtree_root.as_mut_ptr()); @@ -813,7 +813,7 @@ where } else if !node_is_left_child && sibling.left().is_black() { sibling.right().set_black(); sibling.set_red(); - if let Some(subtree_root) = Self::rotate_left(sibling.unwrap()) + if let Some(subtree_root) = Self::rotate_left(sibling.expect("sibling must exist in case 5")) && subtree_root.parent().is_none() { root.set(subtree_root.as_mut_ptr()); @@ -830,7 +830,7 @@ where node.parent().set_black(); if node_is_left_child { sibling.right().set_black(); - if let Some(subtree_root) = Self::rotate_left(node.parent().unwrap()) + if let Some(subtree_root) = Self::rotate_left(node.parent().expect("node must have parent in case 6")) && subtree_root.parent().is_none() { root.set(subtree_root.as_mut_ptr()); @@ -838,7 +838,7 @@ where } } else { sibling.left().set_black(); - if let Some(subtree_root) = Self::rotate_right(node.parent().unwrap()) + if let Some(subtree_root) = Self::rotate_right(node.parent().expect("node must have parent in case 6")) && subtree_root.parent().is_none() { root.set(subtree_root.as_mut_ptr()); diff --git a/core/patina_stacktrace/src/aarch64/mod.rs b/core/patina_stacktrace/src/aarch64.rs similarity index 100% rename from core/patina_stacktrace/src/aarch64/mod.rs rename to core/patina_stacktrace/src/aarch64.rs diff --git a/core/patina_stacktrace/src/aarch64/runtime_function.rs b/core/patina_stacktrace/src/aarch64/runtime_function.rs index 11cf84176..3e546aa2b 100644 --- a/core/patina_stacktrace/src/aarch64/runtime_function.rs +++ b/core/patina_stacktrace/src/aarch64/runtime_function.rs @@ -88,8 +88,8 @@ impl<'a> RuntimeFunction<'a> { [exception_table_rva as usize..(exception_table_rva + exception_table_size) as usize] .chunks(core::mem::size_of::() * 2) // 2 u32 .map(|ele| { - let func_start_rva = ele.read32(0).unwrap(); // unwrap() will work validated above - let unwind_info = ele.read32(4).unwrap(); // unwrap() will work validated above + let func_start_rva = ele.read32(0).expect("chunk is 8 bytes, offset 0 is valid"); + let unwind_info = ele.read32(4).expect("chunk is 8 bytes, offset 4 is valid"); let flag = unwind_info & 0x3; @@ -102,7 +102,7 @@ impl<'a> RuntimeFunction<'a> { 0 => { let xdata_rva = unwind_info as usize; let xdata_header = &pe.bytes[xdata_rva..xdata_rva + 4]; - let xdata_header = xdata_header.read32(0).unwrap(); + let xdata_header = xdata_header.read32(0).expect("xdata header slice is 4 bytes"); (xdata_header & 0x3FFFF) * 4 } // Packed unwind data used with a single prolog and epilog diff --git a/core/patina_stacktrace/src/x64/mod.rs b/core/patina_stacktrace/src/x64.rs similarity index 100% rename from core/patina_stacktrace/src/x64/mod.rs rename to core/patina_stacktrace/src/x64.rs diff --git a/core/patina_stacktrace/src/x64/runtime_function.rs b/core/patina_stacktrace/src/x64/runtime_function.rs index 94a7a432b..fb7f9b369 100644 --- a/core/patina_stacktrace/src/x64/runtime_function.rs +++ b/core/patina_stacktrace/src/x64/runtime_function.rs @@ -90,9 +90,9 @@ impl<'a> RuntimeFunction<'a> { .chunks(core::mem::size_of::() * 3) // 3 u32 .map(|ele| { ( - ele.read32(0).unwrap(), // start_rva - unwrap() will work validated above - ele.read32(4).unwrap(), // end_rva - unwrap() will work validated above - ele.read32(8).unwrap(), // unwindinfo_rva - unwrap() will work validated above + ele.read32(0).expect("chunk is 12 bytes, offset 0 is valid"), + ele.read32(4).expect("chunk is 12 bytes, offset 4 is valid"), + ele.read32(8).expect("chunk is 12 bytes, offset 8 is valid"), ) }) .find(|ele| ele.0 <= rip_rva && rip_rva < ele.1)