Enable unreachable_pub lint

This commit is contained in:
bjorn3
2020-11-09 10:18:43 +01:00
parent d5d5cba8b2
commit ffe9de15fc
2 changed files with 8 additions and 7 deletions

View File

@@ -4,7 +4,8 @@
missing_docs, missing_docs,
trivial_numeric_casts, trivial_numeric_casts,
unused_extern_crates, unused_extern_crates,
unstable_features unstable_features,
unreachable_pub
)] )]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]

View File

@@ -126,7 +126,7 @@ impl Drop for PtrLen {
/// accessible memory. Memory will be leaked by default to have /// accessible memory. Memory will be leaked by default to have
/// function pointers remain valid for the remainder of the /// function pointers remain valid for the remainder of the
/// program's life. /// program's life.
pub struct Memory { pub(crate) struct Memory {
allocations: Vec<PtrLen>, allocations: Vec<PtrLen>,
executable: usize, executable: usize,
current: PtrLen, current: PtrLen,
@@ -134,7 +134,7 @@ pub struct Memory {
} }
impl Memory { impl Memory {
pub fn new() -> Self { pub(crate) fn new() -> Self {
Self { Self {
allocations: Vec::new(), allocations: Vec::new(),
executable: 0, executable: 0,
@@ -150,7 +150,7 @@ impl Memory {
} }
/// TODO: Use a proper error type. /// TODO: Use a proper error type.
pub fn allocate(&mut self, size: usize, align: u64) -> Result<*mut u8, String> { pub(crate) fn allocate(&mut self, size: usize, align: u64) -> Result<*mut u8, String> {
let align = usize::try_from(align).expect("alignment too big"); let align = usize::try_from(align).expect("alignment too big");
if self.position % align != 0 { if self.position % align != 0 {
self.position += align - self.position % align; self.position += align - self.position % align;
@@ -173,7 +173,7 @@ impl Memory {
} }
/// Set all memory allocated in this `Memory` up to now as readable and executable. /// Set all memory allocated in this `Memory` up to now as readable and executable.
pub fn set_readable_and_executable(&mut self) { pub(crate) fn set_readable_and_executable(&mut self) {
self.finish_current(); self.finish_current();
#[cfg(feature = "selinux-fix")] #[cfg(feature = "selinux-fix")]
@@ -202,7 +202,7 @@ impl Memory {
} }
/// Set all memory allocated in this `Memory` up to now as readonly. /// Set all memory allocated in this `Memory` up to now as readonly.
pub fn set_readonly(&mut self) { pub(crate) fn set_readonly(&mut self) {
self.finish_current(); self.finish_current();
#[cfg(feature = "selinux-fix")] #[cfg(feature = "selinux-fix")]
@@ -232,7 +232,7 @@ impl Memory {
/// Frees all allocated memory regions that would be leaked otherwise. /// Frees all allocated memory regions that would be leaked otherwise.
/// Likely to invalidate existing function pointers, causing unsafety. /// Likely to invalidate existing function pointers, causing unsafety.
pub unsafe fn free_memory(&mut self) { pub(crate) unsafe fn free_memory(&mut self) {
self.allocations.clear(); self.allocations.clear();
} }
} }