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 }} - run: rustup override set ${{ matrix.rust_version }}
- name: cargo check - name: cargo check
run: cargo check run: cargo check
- name: cargo fmt --check
run: cargo fmt --check
test: test:
strategy: strategy:
matrix: matrix:

View file

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