chore: run cargo fmt

This commit is contained in:
pasta 2024-10-02 13:50:48 -05:00
parent 1b6e7edb6b
commit d480b14bea
No known key found for this signature in database
GPG key ID: E2F3D7916E722D38
2 changed files with 9 additions and 6 deletions

View file

@ -40,8 +40,12 @@ impl SerializedTorrent {
let add_torrent = if !self.torrent_bytes.is_empty() {
AddTorrent::TorrentFileBytes(self.torrent_bytes)
} else {
let magnet =
Magnet::from_id20(self.info_hash, self.trackers.into_iter().collect(), self.only_files.clone()).to_string();
let magnet = Magnet::from_id20(
self.info_hash,
self.trackers.into_iter().collect(),
self.only_files.clone(),
)
.to_string();
AddTorrent::from_url(magnet)
};

View file

@ -9,7 +9,7 @@ pub struct Magnet {
id20: Option<Id20>,
id32: Option<Id32>,
pub trackers: Vec<String>,
select_only: Option<Vec<usize>>
select_only: Option<Vec<usize>>,
}
impl Magnet {
@ -24,7 +24,7 @@ impl Magnet {
self.select_only.clone()
}
pub fn from_id20(id20: Id20, trackers: Vec<String>, select_only: Option<Vec<usize>> ) -> Self {
pub fn from_id20(id20: Id20, trackers: Vec<String>, select_only: Option<Vec<usize>>) -> Self {
Self {
id20: Some(id20),
id32: None,
@ -187,9 +187,8 @@ mod tests {
);
assert_eq!(
&Magnet::from_id20(id20, Default::default(), Some(vec![1,2,3])).to_string(),
&Magnet::from_id20(id20, Default::default(), Some(vec![1, 2, 3])).to_string(),
"magnet:?xt=urn:btih:a621779b5e3d486e127c3efbca9b6f8d135f52e5&so=1,2,3"
);
}
}