run cargo fmt --check on PRs

This commit is contained in:
Igor Katson 2024-11-06 15:01:59 +00:00
parent e31854cb5a
commit 78363d65ca
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
2 changed files with 35 additions and 8 deletions

View file

@ -23,6 +23,8 @@ jobs:
- run: rustup override set ${{ matrix.rust_version }}
- name: cargo check
run: cargo check
- name: cargo fmt --check
run: cargo fmt --check
test:
strategy:
matrix:

View file

@ -208,9 +208,19 @@ impl Api {
let handle = self.mgr_handle(idx)?;
let info_hash = handle.shared().info_hash;
let only_files = handle.only_files();
let output_folder = handle.shared().options.output_folder.to_string_lossy().into_owned().to_string();
make_torrent_details(&info_hash, &handle.shared().info, only_files.as_deref(), output_folder)
let output_folder = handle
.shared()
.options
.output_folder
.to_string_lossy()
.into_owned()
.to_string();
make_torrent_details(
&info_hash,
&handle.shared().info,
only_files.as_deref(),
output_folder,
)
}
pub fn api_session_stats(&self) -> SessionStatsSnapshot {
@ -343,7 +353,12 @@ impl Api {
&handle.info_hash(),
&handle.shared().info,
handle.only_files().as_deref(),
handle.shared().options.output_folder.to_string_lossy().into_owned(),
handle
.shared()
.options
.output_folder
.to_string_lossy()
.into_owned(),
)
.context("error making torrent details")?;
ApiAddTorrentResponse {
@ -369,15 +384,25 @@ impl Api {
id: None,
output_folder: output_folder.to_string_lossy().into_owned(),
seen_peers: Some(seen_peers),
details: make_torrent_details(&info_hash, &info, only_files.as_deref(), output_folder.to_string_lossy().into_owned().to_string())
.context("error making torrent details")?,
details: make_torrent_details(
&info_hash,
&info,
only_files.as_deref(),
output_folder.to_string_lossy().into_owned().to_string(),
)
.context("error making torrent details")?,
},
AddTorrentResponse::Added(id, handle) => {
let details = make_torrent_details(
&handle.info_hash(),
&handle.shared().info,
handle.only_files().as_deref(),
handle.shared().options.output_folder.to_string_lossy().into_owned(),
handle.only_files().as_deref(),
handle
.shared()
.options
.output_folder
.to_string_lossy()
.into_owned(),
)
.context("error making torrent details")?;
ApiAddTorrentResponse {