Skip to content

Commit 0a346df

Browse files
committed
clippy: Inline variables
1 parent 948705e commit 0a346df

19 files changed

Lines changed: 32 additions & 41 deletions

File tree

api-server/src/api/query/search_torrents.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl SearchTorrentsQuery {
7373
}
7474
}
7575
Err(err) => {
76-
error!("Error:\n{:?}", err);
76+
error!("Error:\n{err:?}");
7777
errors.push(ProviderError::new(
7878
result.provider,
7979
format!("{:?}: {}", err.kind(), err),

api-server/src/background/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ use log::error;
55

66
pub async fn background(context: ContextPointer) {
77
if let Err(error) = movie_tracking(context).await {
8-
error!("MovieTracking error: {:?}", error);
8+
error!("MovieTracking error: {error:?}");
99
}
1010
}

api-server/src/background/movie_tracking.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub async fn movie_tracking(context: ContextPointer) -> Result<(), HttpErrorKind
7575
if let Some(movie) = movie {
7676
let movie_name = movie.format();
7777

78-
info!("Importing \"{}\" as \"{}\"", name, movie_name);
78+
info!("Importing {name:?} as {movie_name:?}");
7979

8080
let remote_path = torrent.get_content_path();
8181

@@ -107,10 +107,10 @@ pub async fn movie_tracking(context: ContextPointer) -> Result<(), HttpErrorKind
107107
.await?;
108108
}
109109
} else {
110-
warn!("No movie found for TMDB id: {}", tmdb);
110+
warn!("No movie found for TMDB id: {tmdb}");
111111
}
112112
} else {
113-
warn!("No TMDB id found for {}", name);
113+
warn!("No TMDB id found for {name}");
114114
}
115115
}
116116
}
@@ -123,13 +123,10 @@ pub async fn movie_tracking(context: ContextPointer) -> Result<(), HttpErrorKind
123123
min_eta = *timeout_inactive;
124124
info!("No active torrents")
125125
} else {
126-
info!(
127-
"Watching {}/{} torrents",
128-
active_torrents, watching_torrents
129-
)
126+
info!("Watching {active_torrents}/{watching_torrents} torrents")
130127
}
131128

132-
info!("Waiting: {}s", min_eta);
129+
info!("Waiting: {min_eta}s");
133130
sleep(Duration::from_secs(min_eta as u64)).await;
134131
}
135132
}

api-server/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async fn rocket() -> _ {
3838

3939
let config = get_config().unwrap_or_else(|e| {
4040
error!("Error missing required config");
41-
error!("{}", e);
41+
error!("{e}");
4242
process::exit(1);
4343
});
4444

api-server/src/models/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ pub fn get_config() -> Result<Config, Error> {
101101
std::process::exit(1);
102102
}
103103

104-
debug!("{:#?}", config);
104+
debug!("{config:#?}");
105105

106106
Ok(config)
107107
}

api-server/src/models/filter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl Filter {
3535
values: filter
3636
.map(|x| FilterItem {
3737
display: to_variant_name(&x).unwrap().to_owned(),
38-
name: format!("{:?}", x),
38+
name: format!("{x:?}"),
3939
})
4040
.collect(),
4141
}

api-server/src/models/http_error.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ pub enum HttpErrorKind {
1616

1717
impl HttpErrorKind {
1818
pub fn param(param: String) -> Self {
19-
Self::InvalidParam(format!("Incorrect param: {}", param))
19+
Self::InvalidParam(format!("Incorrect param: {param}"))
2020
}
2121
pub fn missing_query() -> Self {
2222
Self::MissingQuery("At least `imdb` or `query` must be defined.".into())
2323
}
2424
pub fn imdb_not_found(imdb: String) -> Self {
25-
Self::ImdbNotFound(format!("IMDB ID not found: {}", imdb))
25+
Self::ImdbNotFound(format!("IMDB ID not found: {imdb}"))
2626
}
2727
}
2828

2929
impl Display for HttpErrorKind {
3030
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
31-
write!(f, "{:?}", self)
31+
write!(f, "{self:?}")
3232
}
3333
}
3434

api-server/src/models/movie_files.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl MovieFiles {
7171
movie_file = Some(file);
7272
}
7373
} else if SUBTITLE_FILE_EXTENSIONS.contains(&ext) {
74-
debug!("Found subtitle: {:?}", path);
74+
debug!("Found subtitle: {path:?}");
7575

7676
subtitles.push(path);
7777
}

api-server/src/utils/import_movie.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ pub async fn import_movie(
3030
.unwrap_or(OsStr::new("Unknown Movie")),
3131
);
3232

33-
info!("Copying to {:?}", movie_dest_file);
33+
info!("Copying to {movie_dest_file:?}");
3434
fs::copy(movie_files.movie(), &movie_dest_file).await?;
35-
info!("Movie copied to: {:?}", movie_dest_file);
35+
info!("Movie copied to: {movie_dest_file:?}");
3636

3737
// Copy subtitles
3838
for subtitle in movie_files.subtitles() {
@@ -59,15 +59,12 @@ pub async fn import_movie(
5959
);
6060

6161
if let Some(new_subtitle_path) = new_subtitle_path {
62-
info!(
63-
"Importing subtitle {} to as {}",
64-
subtitle_stem, new_subtitle_path
65-
);
62+
info!("Importing subtitle {subtitle_stem} to as {new_subtitle_path}");
6663

6764
let dest_subtitle = dest_folder.join(new_subtitle_path);
68-
debug!("Copying subtitle to {:?}", dest_subtitle);
65+
debug!("Copying subtitle to {dest_subtitle:?}");
6966
fs::copy(subtitle, &dest_subtitle).await?;
70-
debug!("Subtitle copied to: {:?}", dest_subtitle);
67+
debug!("Subtitle copied to: {dest_subtitle:?}");
7168
}
7269
}
7370

api-server/src/utils/parse_subtitle_language.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ pub fn parse_subtitle_language(
2626
// target_base: MovieFile.2020
2727

2828
if subtitle_name.starts_with(&target_base.to_lowercase()) {
29-
debug!(
30-
"Subtitle {} has the same base name as target file {}",
31-
subtitle_name, target_base
32-
);
29+
debug!("Subtitle {subtitle_name} has the same base name as target file {target_base}");
3330
output.push('.');
3431
output.push_str(subtitle_ext);
3532
return Some(output);

0 commit comments

Comments
 (0)