Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/mft.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmer Ben-Amram <omerbenamram@gmail.com>2020-01-06 14:08:42 +0300
committerOmer Ben-Amram <omerbenamram@gmail.com>2020-01-06 14:08:42 +0300
commit1450e1050d7f97e0e3c7529680553b6a8299beea (patch)
tree96455b23801655835da71ccaaa6d1582f4cc5b2c
parentf267fe8b600ba01f8560efeee7e2a713230bbdae (diff)
clippy lints
-rw-r--r--src/attribute/x80.rs2
-rw-r--r--src/csv.rs18
-rw-r--r--src/entry.rs9
3 files changed, 14 insertions, 15 deletions
diff --git a/src/attribute/x80.rs b/src/attribute/x80.rs
index f194a0e..3f1efa6 100644
--- a/src/attribute/x80.rs
+++ b/src/attribute/x80.rs
@@ -26,6 +26,6 @@ impl ser::Serialize for DataAttr {
where
S: ser::Serializer,
{
- serializer.serialize_str(&utils::to_hex_string(&self.0).to_string())
+ serializer.serialize_str(&utils::to_hex_string(&self.0))
}
}
diff --git a/src/csv.rs b/src/csv.rs
index fbe1b65..1a3aca8 100644
--- a/src/csv.rs
+++ b/src/csv.rs
@@ -93,7 +93,7 @@ impl FlatMftEntryWithName {
let has_ads = entry_attributes
.iter()
.any(|a| {
- a.header.type_code == MftAttributeType::DATA && a.header.name.len() > 0
+ a.header.type_code == MftAttributeType::DATA && !a.header.name.is_empty()
});
@@ -111,14 +111,14 @@ impl FlatMftEntryWithName {
is_a_directory: entry.is_dir(),
is_deleted: !entry.header.flags.contains(EntryFlags::ALLOCATED),
has_alternate_data_streams: has_ads,
- standard_info_flags: standard_info.as_ref().and_then(|i| Some(i.file_flags)),
- standard_info_last_modified: standard_info.as_ref().and_then(|i| Some(i.modified)),
- standard_info_last_access: standard_info.as_ref().and_then(|i| Some(i.accessed)),
- standard_info_created: standard_info.as_ref().and_then(|i| Some(i.created)),
- file_name_flags: file_name.as_ref().and_then(|i| Some(i.flags)),
- file_name_last_modified: file_name.as_ref().and_then(|i| Some(i.modified)),
- file_name_last_access: file_name.as_ref().and_then(|i| Some(i.accessed)),
- file_name_created: file_name.as_ref().and_then(|i| Some(i.created)),
+ standard_info_flags: standard_info.as_ref().map(|i| i.file_flags),
+ standard_info_last_modified: standard_info.as_ref().map(|i| i.modified),
+ standard_info_last_access: standard_info.as_ref().map(|i| i.accessed),
+ standard_info_created: standard_info.as_ref().map(|i| i.created),
+ file_name_flags: file_name.as_ref().map(|i| i.flags),
+ file_name_last_modified: file_name.as_ref().map(|i| i.modified),
+ file_name_last_access: file_name.as_ref().map(|i| i.accessed),
+ file_name_created: file_name.as_ref().map(|i| i.created),
file_size,
full_path: parser
.get_full_path_for_entry(entry)
diff --git a/src/entry.rs b/src/entry.rs
index f1b2a63..9e43855 100644
--- a/src/entry.rs
+++ b/src/entry.rs
@@ -22,9 +22,9 @@ use std::io::{Cursor, Seek};
const SEQUENCE_NUMBER_STRIDE: usize = 512;
-pub const ZERO_HEADER: &'static [u8; 4] = b"\x00\x00\x00\x00";
-pub const BAAD_HEADER: &'static [u8; 4] = b"BAAD";
-pub const FILE_HEADER: &'static [u8; 4] = b"FILE";
+pub const ZERO_HEADER: &[u8; 4] = b"\x00\x00\x00\x00";
+pub const BAAD_HEADER: &[u8; 4] = b"BAAD";
+pub const FILE_HEADER: &[u8; 4] = b"FILE";
#[derive(Debug, Clone)]
pub struct MftEntry {
@@ -239,7 +239,6 @@ impl MftEntry {
/// https://docs.microsoft.com/en-us/windows/desktop/devnotes/multi-sector-header
/// **Note**: The fixup will be written at the end of each 512-byte stride,
/// even if the device has more (or less) than 512 bytes per sector.
- #[must_use]
fn apply_fixups(header: &EntryHeader, buffer: &mut [u8]) -> Result<()> {
let number_of_fixups = u32::from(header.usa_size - 1);
trace!("Number of fixups: {}", number_of_fixups);
@@ -313,7 +312,7 @@ impl MftEntry {
Ok(_) => {}
Err(e) => {
exhausted = true;
- return Some(Err(e.into()));
+ return Some(Err(e));
}
};