Skip to content

Commit

Permalink
fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmr committed Jul 19, 2024
1 parent f46a5a1 commit 4120f12
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/transcription_downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ impl LocalTranscriptionDownloader {

/// Gets the name of the directory where the asset should be downloaded.
fn download_dir(link: &TranscriptionLink) -> String {
let input = match link {
TranscriptionLink::YouTube(yt_link) => yt_link,
};
let TranscriptionLink::YouTube(input) = link;
let mut hasher = Sha1::new();
hasher.update(input.as_bytes());
let hash = hasher.finalize();
Expand All @@ -84,25 +82,23 @@ impl LocalTranscriptionDownloader {

/// Gets the path to the asset file.
fn download_path(link: &TranscriptionLink) -> PathBuf {
Path::new(&Self::download_dir(&link)).join(Self::download_file(link))
Path::new(&Self::download_dir(link)).join(Self::download_file(link))
}

/// Gets the full path to the asset file with the download directory prepended.
fn full_download_path(&self, link: &TranscriptionLink) -> Option<PathBuf> {
match self.preferences.download_path {
Some(ref download_path) => {
Some(Path::new(download_path).join(Self::download_path(link)))
}
None => None,
}
self.preferences
.download_path
.as_ref()
.map(|download_path| Path::new(download_path).join(Self::download_path(link)))
}

/// Gets the full path to the asset file with the alias directory prepended.
fn full_alias_path(&self, link: &TranscriptionLink) -> Option<PathBuf> {
match self.preferences.download_path_alias {
Some(ref alias_path) => Some(Path::new(alias_path).join(Self::download_path(link))),
None => None,
}
self.preferences
.download_path_alias
.as_ref()
.map(|path_alias| Path::new(path_alias).join(Self::download_path(link)))
}

/// Verifies that a binary is installed. The argument should be something simple, like a version
Expand Down

0 comments on commit 4120f12

Please sign in to comment.