Skip to content

Commit 098484c

Browse files
authored
Merge pull request #282 from adamnemecek/master
use Self
2 parents 04aca0a + 29ccbe6 commit 098484c

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

src/adapters/decompress.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ lazy_static! {
4141
pub struct DecompressAdapter;
4242

4343
impl DecompressAdapter {
44-
pub fn new() -> DecompressAdapter {
45-
DecompressAdapter
44+
pub fn new() -> Self {
45+
Self
4646
}
4747
}
4848
impl GetMetadata for DecompressAdapter {

src/adapters/ffmpeg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ lazy_static! {
3838
pub struct FFmpegAdapter;
3939

4040
impl FFmpegAdapter {
41-
pub fn new() -> FFmpegAdapter {
42-
FFmpegAdapter
41+
pub fn new() -> Self {
42+
Self
4343
}
4444
}
4545
impl GetMetadata for FFmpegAdapter {

src/adapters/mbox.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ lazy_static! {
3838
pub struct MboxAdapter;
3939

4040
impl MboxAdapter {
41-
pub fn new() -> MboxAdapter {
42-
MboxAdapter
41+
pub fn new() -> Self {
42+
Self
4343
}
4444
}
4545
impl GetMetadata for MboxAdapter {

src/adapters/sqlite.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ lazy_static! {
3636
pub struct SqliteAdapter;
3737

3838
impl SqliteAdapter {
39-
pub fn new() -> SqliteAdapter {
40-
SqliteAdapter
39+
pub fn new() -> Self {
40+
Self
4141
}
4242
}
4343
impl GetMetadata for SqliteAdapter {

src/adapters/tar.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ lazy_static! {
3636
pub struct TarAdapter;
3737

3838
impl TarAdapter {
39-
pub fn new() -> TarAdapter {
40-
TarAdapter
39+
pub fn new() -> Self {
40+
Self
4141
}
4242
}
4343
impl GetMetadata for TarAdapter {

src/adapters/zip.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ lazy_static! {
2828
pub struct ZipAdapter;
2929

3030
impl ZipAdapter {
31-
pub fn new() -> ZipAdapter {
32-
ZipAdapter
31+
pub fn new() -> Self {
32+
Self
3333
}
3434
}
3535
impl GetMetadata for ZipAdapter {

src/config.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl std::fmt::Display for CacheCompressionLevel {
2525
}
2626
impl Default for CacheCompressionLevel {
2727
fn default() -> Self {
28-
CacheCompressionLevel(12)
28+
Self(12)
2929
}
3030
}
3131
#[derive(JsonSchema, Debug, Serialize, Deserialize, Copy, Clone, PartialEq, FromStr)]
@@ -38,7 +38,7 @@ impl std::fmt::Display for MaxArchiveRecursion {
3838
}
3939
impl Default for MaxArchiveRecursion {
4040
fn default() -> Self {
41-
MaxArchiveRecursion(5)
41+
Self(5)
4242
}
4343
}
4444

@@ -54,7 +54,7 @@ impl Default for CachePath {
5454
fn default() -> Self {
5555
let pd = project_dirs().expect("could not get cache path");
5656
let app_cache = pd.cache_dir();
57-
CachePath(app_cache.to_str().expect("cache path not utf8").to_owned())
57+
Self(app_cache.to_str().expect("cache path not utf8").to_owned())
5858
}
5959
}
6060

@@ -68,7 +68,7 @@ impl std::fmt::Display for CacheMaxBlobLen {
6868
}
6969
impl Default for CacheMaxBlobLen {
7070
fn default() -> Self {
71-
CacheMaxBlobLen(2000000)
71+
Self(2000000)
7272
}
7373
}
7474

@@ -77,7 +77,7 @@ impl FromStr for CacheMaxBlobLen {
7777
fn from_str(s: &str) -> Result<Self, Self::Err> {
7878
let suffix = s.chars().last();
7979
if let Some(suffix) = suffix {
80-
Ok(CacheMaxBlobLen(match suffix {
80+
Ok(Self(match suffix {
8181
'k' | 'M' | 'G' => usize::from_str(s.trim_end_matches(suffix))
8282
.with_context(|| "Could not parse int".to_string())
8383
.map(|e| {

src/matching.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub enum FileMatcher {
3636

3737
impl From<FastFileMatcher> for FileMatcher {
3838
fn from(t: FastFileMatcher) -> Self {
39-
FileMatcher::Fast(t)
39+
Self::Fast(t)
4040
}
4141
}
4242

src/preproc_cache.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl CacheKey {
2222
filepath_hint: &Path,
2323
adapter: &dyn FileAdapter,
2424
active_adapters: &ActiveAdapters,
25-
) -> Result<CacheKey> {
25+
) -> Result<Self> {
2626
let meta = std::fs::metadata(filepath_hint)
2727
.with_context(|| format!("reading metadata for {}", filepath_hint.to_string_lossy()))?;
2828
let modified = meta.modified().expect("weird OS that can't into mtime");
@@ -37,7 +37,7 @@ impl CacheKey {
3737
} else {
3838
"null".to_string()
3939
};
40-
Ok(CacheKey {
40+
Ok(Self {
4141
config_hash: if postprocess {
4242
"a41e2e9".to_string()
4343
} else {
@@ -103,7 +103,7 @@ struct SqliteCache {
103103
db: Connection,
104104
}
105105
impl SqliteCache {
106-
async fn new(path: &Path) -> Result<SqliteCache> {
106+
async fn new(path: &Path) -> Result<Self> {
107107
let db = Connection::open(path.join("cache.sqlite3")).await?;
108108
db.call(|db| {
109109
let schema_version: i32 = db.pragma_query_value(None, "user_version", |r| r.get(0))?;
@@ -118,7 +118,7 @@ impl SqliteCache {
118118

119119
connect_pragmas(&db).await?;
120120

121-
Ok(SqliteCache { db })
121+
Ok(Self { db })
122122
}
123123
}
124124

0 commit comments

Comments
 (0)