Skip to content

Commit

Permalink
chore(lint): override a bunch of lints to level deny
Browse files Browse the repository at this point in the history
  • Loading branch information
Oakchris1955 committed Aug 4, 2024
1 parent b06ee15 commit cf88178
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl IOErrorKind for std::io::ErrorKind {

/// An error type that denotes that there is something wrong
/// with the filesystem's structure itself (perhaps the FS itself is malformed/corrupted)
#[derive(Debug, displaydoc::Display)]
#[derive(Debug, Clone, Copy, displaydoc::Display)]
pub enum InternalFSError {
/// The storage medium isn't large enough to accompany a FAT filesystem
StorageTooSmall,
Expand Down
25 changes: 17 additions & 8 deletions src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ union BootRecord {
exfat: BootRecordExFAT,
}

impl fmt::Debug for BootRecord {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
// TODO: find a good way of printing this
write!(f, "FAT/ExFAT boot record...")
}
}

#[derive(Clone, Copy)]
#[repr(packed)]
union EBR {
Expand Down Expand Up @@ -612,6 +619,7 @@ impl ops::Deref for DirEntry {
}

/// A file within the FAT filesystem
#[derive(Debug)]
pub struct File<'a, S>
where
S: Read + Write + Seek,
Expand All @@ -623,7 +631,7 @@ where
current_cluster: u32,
}

impl<'a, S> Deref for File<'a, S>
impl<S> Deref for File<'_, S>
where
S: Read + Write + Seek,
{
Expand All @@ -634,15 +642,15 @@ where
}
}

impl<'a, S> IOBase for File<'a, S>
impl<S> IOBase for File<'_, S>
where
S: Read + Write + Seek,
{
type Error = S::Error;
}

/// Internal functions
impl<'a, S> File<'a, S>
impl<S> File<'_, S>
where
S: Read + Write + Seek,
{
Expand All @@ -658,7 +666,7 @@ where
}
}

impl<'a, S> Read for File<'a, S>
impl<S> Read for File<'_, S>
where
S: Read + Write + Seek,
{
Expand Down Expand Up @@ -728,7 +736,7 @@ where
}
}

impl<'a, S> Seek for File<'a, S>
impl<S> Seek for File<'_, S>
where
S: Read + Write + Seek,
{
Expand Down Expand Up @@ -774,7 +782,7 @@ where
}
}

impl<'a, S> File<'a, S>
impl<S> File<'_, S>
where
S: Read + Write + Seek,
{
Expand Down Expand Up @@ -852,6 +860,7 @@ struct FSProperties {
}

/// An API to process a FAT filesystem
#[derive(Debug)]
pub struct FileSystem<S>
where
S: Read + Write + Seek,
Expand Down Expand Up @@ -1035,7 +1044,7 @@ where
/// Borrows `&mut self` until that [`File`] object is dropped, effectively locking `self` until that file closed
///
/// Fails if `path` doesn't represent a file, or if that file doesn't exist
pub fn get_file(&mut self, path: PathBuf) -> FSResult<File<S>, S::Error> {
pub fn get_file(&mut self, path: PathBuf) -> FSResult<File<'_, S>, S::Error> {
if path.is_malformed() {
return Err(FSError::MalformedPath);
}
Expand Down Expand Up @@ -1392,7 +1401,7 @@ mod tests {
}

static BEE_MOVIE_SCRIPT: &str = include_str!("../tests/bee movie script.txt");
fn assert_file_is_bee_movie_script<S>(file: &mut File<S>)
fn assert_file_is_bee_movie_script<S>(file: &mut File<'_, S>)
where
S: Read + Write + Seek,
{
Expand Down
1 change: 1 addition & 0 deletions src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ pub trait Write: IOBase {
}

/// A copy of [`std::io::SeekFrom`] for use within a `no_std` context
#[derive(Debug, Clone, Copy)]
pub enum SeekFrom {
/// Sets the offset to the provided number of bytes.
Start(u64),
Expand Down
14 changes: 13 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,20 @@

#![cfg_attr(not(feature = "std"), no_std)]
// Even inside unsafe functions, we must acknowlegde the usage of unsafe code
#![deny(unsafe_op_in_unsafe_fn)]
#![deny(deprecated)]
#![deny(elided_lifetimes_in_paths)]
#![deny(macro_use_extern_crate)]
#![deny(missing_copy_implementations)]
#![deny(missing_debug_implementations)]
#![deny(missing_docs)]
#![deny(non_ascii_idents)]
#![deny(trivial_numeric_casts)]
#![deny(single_use_lifetimes)]
#![deny(unsafe_op_in_unsafe_fn)]
#![deny(unused_crate_dependencies)]
#![deny(unused_extern_crates)]
#![deny(unused_import_braces)]
#![deny(unused_lifetimes)]

extern crate alloc;

Expand Down

0 comments on commit cf88178

Please sign in to comment.