diff options
author | adamnemecek <adamnemecek@gmail.com> | 2025-01-03 06:58:57 +0000 |
---|---|---|
committer | adamnemecek <adamnemecek@gmail.com> | 2025-01-03 17:17:41 +0000 |
commit | dad77b656c130f43d9de66f0f28e49fa1418f291 (patch) | |
tree | b4affed9c0f82ba4a846e7d9d15bc7f130523401 /src/archive.rs | |
parent | Merge pull request #1463 from svenstaro/dependabot/cargo/all-dependencies-435... (diff) | |
download | miniserve-dad77b656c130f43d9de66f0f28e49fa1418f291.tar.gz miniserve-dad77b656c130f43d9de66f0f28e49fa1418f291.zip |
Use Self where possible
Diffstat (limited to '')
-rw-r--r-- | src/archive.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/archive.rs b/src/archive.rs index b8ba4d4..da79ef8 100644 --- a/src/archive.rs +++ b/src/archive.rs @@ -28,27 +28,27 @@ pub enum ArchiveMethod { impl ArchiveMethod { pub fn extension(self) -> String { match self { - ArchiveMethod::TarGz => "tar.gz", - ArchiveMethod::Tar => "tar", - ArchiveMethod::Zip => "zip", + Self::TarGz => "tar.gz", + Self::Tar => "tar", + Self::Zip => "zip", } .to_string() } pub fn content_type(self) -> String { match self { - ArchiveMethod::TarGz => "application/gzip", - ArchiveMethod::Tar => "application/tar", - ArchiveMethod::Zip => "application/zip", + Self::TarGz => "application/gzip", + Self::Tar => "application/tar", + Self::Zip => "application/zip", } .to_string() } pub fn is_enabled(self, tar_enabled: bool, tar_gz_enabled: bool, zip_enabled: bool) -> bool { match self { - ArchiveMethod::TarGz => tar_gz_enabled, - ArchiveMethod::Tar => tar_enabled, - ArchiveMethod::Zip => zip_enabled, + Self::TarGz => tar_gz_enabled, + Self::Tar => tar_enabled, + Self::Zip => zip_enabled, } } @@ -69,9 +69,9 @@ impl ArchiveMethod { { let dir = dir.as_ref(); match self { - ArchiveMethod::TarGz => tar_gz(dir, skip_symlinks, out), - ArchiveMethod::Tar => tar_dir(dir, skip_symlinks, out), - ArchiveMethod::Zip => zip_dir(dir, skip_symlinks, out), + Self::TarGz => tar_gz(dir, skip_symlinks, out), + Self::Tar => tar_dir(dir, skip_symlinks, out), + Self::Zip => zip_dir(dir, skip_symlinks, out), } } } |