Clean up FileType enum following enum namespacing
All of the enum components had a redundant 'Type' specifier: TypeSymlink, TypeDirectory, TypeFile. This change removes them, replacing them with a namespace: FileType::Symlink, FileType::Directory, and FileType::RegularFile. RegularFile is used instead of just File, as File by itself could be mistakenly thought of as referring to the struct. [breaking-change]
This commit is contained in:
parent
4334d3c196
commit
3b9dfd6af0
6 changed files with 35 additions and 36 deletions
|
@ -305,12 +305,12 @@ fn mkstat(stat: &libc::stat) -> FileStat {
|
|||
FileStat {
|
||||
size: stat.st_size as u64,
|
||||
kind: match (stat.st_mode as libc::mode_t) & libc::S_IFMT {
|
||||
libc::S_IFREG => io::TypeFile,
|
||||
libc::S_IFDIR => io::TypeDirectory,
|
||||
libc::S_IFIFO => io::TypeNamedPipe,
|
||||
libc::S_IFBLK => io::TypeBlockSpecial,
|
||||
libc::S_IFLNK => io::TypeSymlink,
|
||||
_ => io::TypeUnknown,
|
||||
libc::S_IFREG => io::FileType::RegularFile,
|
||||
libc::S_IFDIR => io::FileType::Directory,
|
||||
libc::S_IFIFO => io::FileType::NamedPipe,
|
||||
libc::S_IFBLK => io::FileType::BlockSpecial,
|
||||
libc::S_IFLNK => io::FileType::Symlink,
|
||||
_ => io::FileType::Unknown,
|
||||
},
|
||||
perm: FilePermission::from_bits_truncate(stat.st_mode as u32),
|
||||
created: mktime(stat.st_ctime as u64, stat.st_ctime_nsec as u64),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue