Fix warnings and clippy errors
type: reform
This commit is contained in:
parent
2346c30fec
commit
379a001f47
11
.github/workflows/build.yaml
vendored
11
.github/workflows/build.yaml
vendored
|
@ -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: |
|
||||
|
|
1
rust-toolchain
Normal file
1
rust-toolchain
Normal file
|
@ -0,0 +1 @@
|
|||
1.51.0
|
|
@ -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(),
|
||||
})
|
||||
}
|
||||
};
|
||||
|
|
|
@ -41,7 +41,7 @@ impl Env {
|
|||
.and_then(|width| width.parse::<usize>().ok());
|
||||
|
||||
if let Some(width) = width {
|
||||
app = app.set_term_width(width)
|
||||
app = app.set_term_width(width);
|
||||
}
|
||||
|
||||
app
|
||||
|
|
|
@ -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<String>,
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ impl Linter {
|
|||
}
|
||||
|
||||
pub(crate) fn allow(&mut self, allowed: impl IntoIterator<Item = Lint>) {
|
||||
self.allowed.extend(allowed)
|
||||
self.allowed.extend(allowed);
|
||||
}
|
||||
|
||||
pub(crate) fn is_allowed(&self, lint: Lint) -> bool {
|
||||
|
|
|
@ -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::<serde_hex::Strict>")]
|
||||
bytes: [u8; 16],
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::common::*;
|
||||
|
||||
#[serde(untagged)]
|
||||
#[derive(Deserialize, Serialize, Debug, PartialEq, Clone)]
|
||||
#[serde(untagged)]
|
||||
pub(crate) enum Mode {
|
||||
Single {
|
||||
length: Bytes,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use crate::common::*;
|
||||
|
||||
pub(crate) struct OutputStream {
|
||||
active: bool,
|
||||
stream: Box<dyn Write>,
|
||||
style: bool,
|
||||
term: bool,
|
||||
active: bool,
|
||||
}
|
||||
|
||||
impl OutputStream {
|
||||
|
|
|
@ -62,6 +62,6 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn variants() {
|
||||
assert_eq!(Shell::VARIANTS, clap::Shell::variants())
|
||||
assert_eq!(Shell::VARIANTS, clap::Shell::variants());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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(),
|
||||
|
|
Loading…
Reference in New Issue
Block a user