Skip to content

Commit

Permalink
🎨 🔨 simplify the windows cfg
Browse files Browse the repository at this point in the history
Signed-off-by: Wei Zhang <[email protected]>
  • Loading branch information
zwpaper committed Feb 16, 2024
1 parent bc6c930 commit b4d4462
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/meta/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ mod permissions;
mod permissions_or_attributes;
mod size;
mod symlink;
mod windows_attributes;

#[cfg(windows)]
mod windows_attributes;
#[cfg(windows)]
mod windows_utils;

Expand Down
4 changes: 1 addition & 3 deletions src/meta/name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,7 @@ impl Ord for Name {

impl PartialOrd for Name {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.name
.to_lowercase()
.partial_cmp(&other.name.to_lowercase())
Some(self.cmp(other))
}
}

Expand Down
7 changes: 1 addition & 6 deletions src/meta/windows_attributes.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#[cfg(windows)]
use crate::{
color::{ColoredString, Colors, Elem},
flags::Flags,
};
#[cfg(windows)]

use std::os::windows::fs::MetadataExt;

#[cfg(windows)]
#[derive(Debug, Clone)]
pub struct WindowsAttributes {
pub archive: bool,
Expand All @@ -15,7 +13,6 @@ pub struct WindowsAttributes {
pub system: bool,
}

#[cfg(windows)]
pub fn get_attributes(metadata: &std::fs::Metadata) -> WindowsAttributes {
use windows::Win32::Storage::FileSystem::{
FILE_ATTRIBUTE_ARCHIVE, FILE_ATTRIBUTE_HIDDEN, FILE_ATTRIBUTE_READONLY,
Expand All @@ -34,7 +31,6 @@ pub fn get_attributes(metadata: &std::fs::Metadata) -> WindowsAttributes {
}
}

#[cfg(windows)]
impl WindowsAttributes {
pub fn render(&self, colors: &Colors, _flags: &Flags) -> ColoredString {
let res = [
Expand Down Expand Up @@ -64,7 +60,6 @@ impl WindowsAttributes {
}
}

#[cfg(windows)]
#[cfg(test)]
mod test {
use std::fs;
Expand Down

0 comments on commit b4d4462

Please sign in to comment.