Skip to content

Commit

Permalink
fix: clippy error
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed Dec 26, 2023
1 parent 9ada2d6 commit 219dff0
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions src/models/torrent_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@ impl Torrent {
/// This function will panic if the `torrent_info.pieces` is not a valid
/// hex string.
#[must_use]
pub fn from_database(
db_torrent: &DbTorrent,
torrent_files: &Vec<TorrentFile>,
torrent_announce_urls: Vec<Vec<String>>,
) -> Self {
pub fn from_database(db_torrent: &DbTorrent, torrent_files: &[TorrentFile], torrent_announce_urls: Vec<Vec<String>>) -> Self {
let info_dict = TorrentInfoDictionary::with(
&db_torrent.name,
db_torrent.piece_length,
Expand Down Expand Up @@ -195,14 +191,7 @@ impl TorrentInfoDictionary {
/// - The `pieces` field is not a valid hex string.
/// - For single files torrents the `TorrentFile` path is empty.
#[must_use]
pub fn with(
name: &str,
piece_length: i64,
private: Option<u8>,
root_hash: i64,
pieces: &str,
files: &Vec<TorrentFile>,
) -> Self {
pub fn with(name: &str, piece_length: i64, private: Option<u8>, root_hash: i64, pieces: &str, files: &[TorrentFile]) -> Self {
let mut info_dict = Self {
name: name.to_string(),
pieces: None,
Expand Down Expand Up @@ -249,7 +238,7 @@ impl TorrentInfoDictionary {

info_dict.path = path;
} else {
info_dict.files = Some(files.clone());
info_dict.files = Some(files.to_vec());
}

info_dict
Expand Down

0 comments on commit 219dff0

Please sign in to comment.