Skip to content

Commit 36e15b2

Browse files
authored
Merge pull request #1466 from adamnemecek/master
Use Self where possible.
2 parents e57342e + dad77b6 commit 36e15b2

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

src/archive.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,27 @@ pub enum ArchiveMethod {
2828
impl ArchiveMethod {
2929
pub fn extension(self) -> String {
3030
match self {
31-
ArchiveMethod::TarGz => "tar.gz",
32-
ArchiveMethod::Tar => "tar",
33-
ArchiveMethod::Zip => "zip",
31+
Self::TarGz => "tar.gz",
32+
Self::Tar => "tar",
33+
Self::Zip => "zip",
3434
}
3535
.to_string()
3636
}
3737

3838
pub fn content_type(self) -> String {
3939
match self {
40-
ArchiveMethod::TarGz => "application/gzip",
41-
ArchiveMethod::Tar => "application/tar",
42-
ArchiveMethod::Zip => "application/zip",
40+
Self::TarGz => "application/gzip",
41+
Self::Tar => "application/tar",
42+
Self::Zip => "application/zip",
4343
}
4444
.to_string()
4545
}
4646

4747
pub fn is_enabled(self, tar_enabled: bool, tar_gz_enabled: bool, zip_enabled: bool) -> bool {
4848
match self {
49-
ArchiveMethod::TarGz => tar_gz_enabled,
50-
ArchiveMethod::Tar => tar_enabled,
51-
ArchiveMethod::Zip => zip_enabled,
49+
Self::TarGz => tar_gz_enabled,
50+
Self::Tar => tar_enabled,
51+
Self::Zip => zip_enabled,
5252
}
5353
}
5454

@@ -69,9 +69,9 @@ impl ArchiveMethod {
6969
{
7070
let dir = dir.as_ref();
7171
match self {
72-
ArchiveMethod::TarGz => tar_gz(dir, skip_symlinks, out),
73-
ArchiveMethod::Tar => tar_dir(dir, skip_symlinks, out),
74-
ArchiveMethod::Zip => zip_dir(dir, skip_symlinks, out),
72+
Self::TarGz => tar_gz(dir, skip_symlinks, out),
73+
Self::Tar => tar_dir(dir, skip_symlinks, out),
74+
Self::Zip => zip_dir(dir, skip_symlinks, out),
7575
}
7676
}
7777
}

src/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ impl MiniserveConfig {
269269
.transpose()?
270270
.unwrap_or_default();
271271

272-
Ok(MiniserveConfig {
272+
Ok(Self {
273273
verbose: args.verbose,
274274
path: args.path.unwrap_or_else(|| PathBuf::from(".")),
275275
port,

src/listing.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ impl Entry {
121121
last_modification_date: Option<SystemTime>,
122122
symlink_info: Option<String>,
123123
) -> Self {
124-
Entry {
124+
Self {
125125
name,
126126
entry_type,
127127
link,
@@ -153,7 +153,7 @@ pub struct Breadcrumb {
153153

154154
impl Breadcrumb {
155155
fn new(name: String, link: String) -> Self {
156-
Breadcrumb { name, link }
156+
Self { name, link }
157157
}
158158
}
159159

src/pipe.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub struct Pipe {
1717
impl Pipe {
1818
/// Wrap the given sender in a `Pipe`.
1919
pub fn new(destination: Sender<io::Result<Bytes>>) -> Self {
20-
Pipe {
20+
Self {
2121
dest: destination,
2222
bytes: BytesMut::new(),
2323
}

src/renderer.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,10 @@ pub enum ThemeSlug {
326326
impl ThemeSlug {
327327
pub fn css(&self) -> &str {
328328
match self {
329-
ThemeSlug::Squirrel => grass::include!("data/themes/squirrel.scss"),
330-
ThemeSlug::Archlinux => grass::include!("data/themes/archlinux.scss"),
331-
ThemeSlug::Zenburn => grass::include!("data/themes/zenburn.scss"),
332-
ThemeSlug::Monokai => grass::include!("data/themes/monokai.scss"),
329+
Self::Squirrel => grass::include!("data/themes/squirrel.scss"),
330+
Self::Archlinux => grass::include!("data/themes/archlinux.scss"),
331+
Self::Zenburn => grass::include!("data/themes/zenburn.scss"),
332+
Self::Monokai => grass::include!("data/themes/monokai.scss"),
333333
}
334334
}
335335

0 commit comments

Comments
 (0)