diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index eecb73d..f0e74ec 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -63,14 +63,9 @@ jobs: target key: cargo-${{ env.CACHE_KEY }}-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} - - name: Install Stable - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: ${{matrix.target}} - profile: minimal - components: clippy, rustfmt - override: true + - name: Install Rust Toolchain Components + run: | + rustup component add clippy rustfmt - name: Info run: | diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 0000000..ba0a719 --- /dev/null +++ b/rust-toolchain @@ -0,0 +1 @@ +1.51.0 diff --git a/src/bytes.rs b/src/bytes.rs index 66e12f1..9212831 100644 --- a/src/bytes.rs +++ b/src/bytes.rs @@ -7,8 +7,8 @@ const TI: u64 = GI << 10; const PI: u64 = TI << 10; const EI: u64 = PI << 10; -#[serde(transparent)] #[derive(Debug, PartialEq, Copy, Clone, PartialOrd, Ord, Eq, Serialize, Deserialize, Default)] +#[serde(transparent)] pub(crate) struct Bytes(pub(crate) u64); impl Bytes { @@ -89,7 +89,7 @@ impl FromStr for Bytes { _ => { return Err(Error::ByteSuffix { text: text.to_owned(), - suffix: suffix.to_owned(), + suffix: suffix.clone(), }) } }; diff --git a/src/env.rs b/src/env.rs index 9b02c04..b6a1efe 100644 --- a/src/env.rs +++ b/src/env.rs @@ -41,7 +41,7 @@ impl Env { .and_then(|width| width.parse::().ok()); if let Some(width) = width { - app = app.set_term_width(width) + app = app.set_term_width(width); } app diff --git a/src/file_path.rs b/src/file_path.rs index fea8e69..b5aa0e7 100644 --- a/src/file_path.rs +++ b/src/file_path.rs @@ -1,7 +1,7 @@ use crate::common::*; -#[serde(transparent)] #[derive(Deserialize, Serialize, Debug, PartialEq, Clone, Ord, PartialOrd, Eq)] +#[serde(transparent)] pub(crate) struct FilePath { components: Vec, } diff --git a/src/linter.rs b/src/linter.rs index d55df28..5709c41 100644 --- a/src/linter.rs +++ b/src/linter.rs @@ -12,7 +12,7 @@ impl Linter { } pub(crate) fn allow(&mut self, allowed: impl IntoIterator) { - self.allowed.extend(allowed) + self.allowed.extend(allowed); } pub(crate) fn is_allowed(&self, lint: Lint) -> bool { diff --git a/src/md5_digest.rs b/src/md5_digest.rs index f2a64c9..bf4b5df 100644 --- a/src/md5_digest.rs +++ b/src/md5_digest.rs @@ -1,7 +1,7 @@ use crate::common::*; -#[serde(transparent)] #[derive(Deserialize, Serialize, Debug, Eq, PartialEq, Copy, Clone)] +#[serde(transparent)] pub(crate) struct Md5Digest { #[serde(with = "SerHex::")] bytes: [u8; 16], diff --git a/src/mode.rs b/src/mode.rs index f58083d..be9d06a 100644 --- a/src/mode.rs +++ b/src/mode.rs @@ -1,7 +1,7 @@ use crate::common::*; -#[serde(untagged)] #[derive(Deserialize, Serialize, Debug, PartialEq, Clone)] +#[serde(untagged)] pub(crate) enum Mode { Single { length: Bytes, diff --git a/src/output_stream.rs b/src/output_stream.rs index d443beb..035736e 100644 --- a/src/output_stream.rs +++ b/src/output_stream.rs @@ -1,10 +1,10 @@ use crate::common::*; pub(crate) struct OutputStream { + active: bool, stream: Box, style: bool, term: bool, - active: bool, } impl OutputStream { diff --git a/src/shell.rs b/src/shell.rs index 8f6a783..1c7bd87 100644 --- a/src/shell.rs +++ b/src/shell.rs @@ -62,6 +62,6 @@ mod tests { #[test] fn variants() { - assert_eq!(Shell::VARIANTS, clap::Shell::variants()) + assert_eq!(Shell::VARIANTS, clap::Shell::variants()); } } diff --git a/src/subcommand/torrent/create.rs b/src/subcommand/torrent/create.rs index 294c4b5..a34d27c 100644 --- a/src/subcommand/torrent/create.rs +++ b/src/subcommand/torrent/create.rs @@ -338,9 +338,7 @@ impl Create { if let OutputTarget::Path(path) = &output { if !self.force && path.exists() { - return Err(Error::OutputExists { - path: path.to_owned(), - }); + return Err(Error::OutputExists { path: path.clone() }); } } @@ -1151,7 +1149,7 @@ mod tests { length: Bytes(3), md5sum: None, } - ) + ); } #[test] @@ -1182,7 +1180,7 @@ mod tests { length: Bytes(4), md5sum: None, } - ) + ); } #[test] @@ -1213,7 +1211,7 @@ mod tests { length: Bytes(4), md5sum: None, } - ) + ); } #[test] @@ -1258,7 +1256,7 @@ mod tests { }, ], } - ) + ); } #[test] @@ -1285,7 +1283,7 @@ mod tests { length: Bytes(3), md5sum: None, } - ) + ); } #[test] @@ -1319,7 +1317,7 @@ mod tests { length: Bytes(3), md5sum: None, } - ) + ); } #[test] @@ -1346,7 +1344,7 @@ mod tests { length: Bytes(0), md5sum: None, } - ) + ); } #[test] @@ -1367,7 +1365,7 @@ mod tests { env.assert_ok(); let metainfo = env.load_metainfo("foo.torrent"); assert_eq!(metainfo.info.pieces.count(), 0); - assert_eq!(metainfo.info.mode, Mode::Multiple { files: Vec::new() }) + assert_eq!(metainfo.info.mode, Mode::Multiple { files: Vec::new() }); } #[test] diff --git a/src/test_env.rs b/src/test_env.rs index 18ca2fb..26e1524 100644 --- a/src/test_env.rs +++ b/src/test_env.rs @@ -37,19 +37,19 @@ macro_rules! test_env { pub(crate) struct TestEnv { env: Env, - #[allow(unused)] - tempdir: TempDir, err: Capture, out: Capture, + #[allow(unused)] + tempdir: TempDir, } impl TestEnv { pub(crate) fn new(tempdir: TempDir, env: Env, err: Capture, out: Capture) -> TestEnv { Self { - tempdir, - err, env, + err, out, + tempdir, } } diff --git a/src/torrent_summary.rs b/src/torrent_summary.rs index 5bd863f..90bcbf5 100644 --- a/src/torrent_summary.rs +++ b/src/torrent_summary.rs @@ -177,7 +177,7 @@ impl TorrentSummary { fn torrent_summary_data(&self) -> TorrentSummaryJson { let (file_count, files) = match &self.metainfo.info.mode { - Mode::Single { .. } => (1, vec![self.metainfo.info.name.to_owned()]), + Mode::Single { .. } => (1, vec![self.metainfo.info.name.clone()]), Mode::Multiple { files } => ( files.len(), files @@ -197,7 +197,7 @@ impl TorrentSummary { }; TorrentSummaryJson { - name: self.metainfo.info.name.to_owned(), + name: self.metainfo.info.name.clone(), comment: self.metainfo.comment.clone(), creation_date: self.metainfo.creation_date, created_by: self.metainfo.created_by.clone(),