mirror of
https://github.com/casey/intermodal
synced 2024-09-29 21:04:44 +00:00
Fix install script (#509)
- Use GitHub API to fetch latest release - Use more secure cURL options - Give up on signing commits
This commit is contained in:
parent
984543fcb9
commit
2a748fc533
17
.github/workflows/build.yaml
vendored
17
.github/workflows/build.yaml
vendored
|
@ -64,8 +64,11 @@ jobs:
|
|||
key: cargo-${{ env.CACHE_KEY }}-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Install Rust Toolchain Components
|
||||
run: |
|
||||
rustup component add clippy rustfmt
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
components: clippy, rustfmt
|
||||
override: true
|
||||
toolchain: 1.56.0
|
||||
|
||||
- name: Info
|
||||
run: |
|
||||
|
@ -88,16 +91,8 @@ jobs:
|
|||
brew install ripgrep
|
||||
./bin/lint
|
||||
|
||||
- name: Install Nightly
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: nightly
|
||||
target: ${{matrix.target}}
|
||||
profile: minimal
|
||||
components: rustfmt
|
||||
|
||||
- name: Check Formatting
|
||||
run: cargo +nightly fmt --all -- --check
|
||||
run: cargo fmt --all -- --check
|
||||
|
||||
- name: Check Generated
|
||||
if: matrix.os == 'macos-latest'
|
||||
|
|
12
Cargo.lock
generated
12
Cargo.lock
generated
|
@ -908,6 +908,12 @@ version = "0.20.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5"
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"
|
||||
|
||||
[[package]]
|
||||
name = "oorandom"
|
||||
version = "11.1.2"
|
||||
|
@ -1515,11 +1521,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.0.1"
|
||||
version = "1.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
|
||||
checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -43,7 +43,6 @@ For more about the project and its goals, check out
|
|||
- [Benchmarks](#benchmarks)
|
||||
- [Semantic Versioning](#semantic-versioning)
|
||||
- [Unstable Features](#unstable-features)
|
||||
- [Source Signatures](#source-signatures)
|
||||
- [Acknowledgments](#acknowledgments)
|
||||
|
||||
## Installation
|
||||
|
@ -306,14 +305,6 @@ are unavailable unless the `--unstable` / `-u` flag is passed, for example
|
|||
`imdl --unstable torrent create .`. Unstable features may be changed or removed
|
||||
at any time.
|
||||
|
||||
## Source Signatures
|
||||
|
||||
All commits to the intermodal master branch signed with Casey Rodarmor's PGP
|
||||
key with fingerprint `3259DAEDB29636B0E2025A70556186B153EC6FE0`, which can be
|
||||
found
|
||||
[on keybase](https://keybase.io/rodarmor/pgp_keys.asc?fingerprint=3259daedb29636b0e2025a70556186b153ec6fe0) and on
|
||||
[his homepage](https://rodarmor.com/static/rodarmor.asc).
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
The formatting of `imdl torrent show` is entirely copied from
|
||||
|
|
|
@ -5,7 +5,7 @@ use imdl::bench::{Bench, HasherBench};
|
|||
fn bench(c: &mut Criterion) {
|
||||
let bench = HasherBench::init();
|
||||
|
||||
c.bench_function(&bench.name(), |b| b.iter(|| bench.iter()));
|
||||
c.bench_function(&bench.name(), |b| b.iter(|| bench.iteration()));
|
||||
}
|
||||
|
||||
criterion_group!(benches, bench);
|
||||
|
|
|
@ -280,14 +280,6 @@ are unavailable unless the `--unstable` / `-u` flag is passed, for example
|
|||
`imdl --unstable torrent create .`. Unstable features may be changed or removed
|
||||
at any time.
|
||||
|
||||
## Source Signatures
|
||||
|
||||
All commits to the intermodal master branch signed with Casey Rodarmor's PGP
|
||||
key with fingerprint `3259DAEDB29636B0E2025A70556186B153EC6FE0`, which can be
|
||||
found
|
||||
[on keybase](https://keybase.io/rodarmor/pgp_keys.asc?fingerprint=3259daedb29636b0e2025a70556186b153ec6fe0) and on
|
||||
[his homepage](https://rodarmor.com/static/rodarmor.asc).
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
The formatting of `imdl torrent show` is entirely copied from
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
1.51.0
|
23
rustfmt.toml
23
rustfmt.toml
|
@ -1,17 +1,6 @@
|
|||
comment_width = 80
|
||||
edition = "2018"
|
||||
error_on_line_overflow = true
|
||||
error_on_unformatted = true
|
||||
format_code_in_doc_comments = true
|
||||
format_macro_bodies = true
|
||||
format_strings = true
|
||||
imports_granularity = "Crate"
|
||||
max_width = 100
|
||||
newline_style = "Unix"
|
||||
normalize_comments = true
|
||||
reorder_impl_items = true
|
||||
tab_spaces = 2
|
||||
unstable_features = true
|
||||
use_field_init_shorthand = true
|
||||
use_try_shorthand = true
|
||||
wrap_comments = true
|
||||
edition = "2018"
|
||||
max_width = 100
|
||||
newline_style = "Unix"
|
||||
tab_spaces = 2
|
||||
use_field_init_shorthand = true
|
||||
use_try_shorthand = true
|
||||
|
|
|
@ -14,7 +14,7 @@ pub trait Bench {
|
|||
|
||||
fn name(&self) -> String;
|
||||
|
||||
fn iter(&self);
|
||||
fn iteration(&self);
|
||||
}
|
||||
|
||||
pub struct HasherBench {
|
||||
|
@ -51,7 +51,7 @@ impl Bench for HasherBench {
|
|||
Self { tempfile }
|
||||
}
|
||||
|
||||
fn iter(&self) {
|
||||
fn iteration(&self) {
|
||||
let files = Files::file(
|
||||
self.tempfile.as_ref().to_owned(),
|
||||
Bytes::from(TEMPFILE_BYTES),
|
||||
|
|
|
@ -13,7 +13,7 @@ impl Capture {
|
|||
}
|
||||
|
||||
pub(crate) fn string(&self) -> String {
|
||||
str::from_utf8(&self.cursor.borrow().get_ref())
|
||||
str::from_utf8(self.cursor.borrow().get_ref())
|
||||
.unwrap()
|
||||
.to_owned()
|
||||
}
|
||||
|
|
|
@ -244,9 +244,11 @@ mod tests {
|
|||
};
|
||||
env.status().ok();
|
||||
let err = env.err();
|
||||
if !err.starts_with("error: Failed to parse announce URL:") {
|
||||
panic!("Unexpected standard error output: {}", err);
|
||||
}
|
||||
assert!(
|
||||
err.starts_with("error: Failed to parse announce URL:"),
|
||||
"Unexpected standard error output: {}",
|
||||
err
|
||||
);
|
||||
|
||||
assert_eq!(env.out(), "");
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ impl FilePath {
|
|||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn from_components(components: &[&str]) -> FilePath {
|
||||
let components: Vec<String> = components.iter().cloned().map(ToOwned::to_owned).collect();
|
||||
let components: Vec<String> = components.iter().copied().map(ToOwned::to_owned).collect();
|
||||
assert!(!components.is_empty());
|
||||
FilePath { components }
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ impl Hasher {
|
|||
|
||||
pub(crate) fn hash_files(mut self, files: &Files) -> Result<(Mode, PieceList), Error> {
|
||||
let mode = if let Some(contents) = files.contents() {
|
||||
let files = self.hash_contents(&files.root(), contents)?;
|
||||
let files = self.hash_contents(files.root(), contents)?;
|
||||
|
||||
Mode::Multiple { files }
|
||||
} else {
|
||||
|
|
|
@ -32,7 +32,7 @@ impl FromStr for HostPort {
|
|||
.invariant_unwrap("Capture group `port` always present")
|
||||
.as_str();
|
||||
|
||||
let host = Host::parse(&host_text).context(host_port_parse_error::Host {
|
||||
let host = Host::parse(host_text).context(host_port_parse_error::Host {
|
||||
text: text.to_owned(),
|
||||
})?;
|
||||
|
||||
|
@ -109,7 +109,9 @@ mod tests {
|
|||
|
||||
fn case(host: Host, port: u16, text: &str, bencode: &str) {
|
||||
let node = HostPort { host, port };
|
||||
let parsed: HostPort = text.parse().expect(&format!("Failed to parse {}", text));
|
||||
let parsed: HostPort = text
|
||||
.parse()
|
||||
.unwrap_or_else(|_| panic!("Failed to parse {}", text));
|
||||
assert_eq!(parsed, node);
|
||||
let ser = bendy::serde::to_bytes(&node).unwrap();
|
||||
assert_eq!(
|
||||
|
|
35
src/lib.rs
35
src/lib.rs
|
@ -1,42 +1,15 @@
|
|||
#![deny(clippy::all, clippy::pedantic, clippy::restriction)]
|
||||
#![deny(clippy::all, clippy::pedantic)]
|
||||
#![allow(
|
||||
clippy::blanket_clippy_restriction_lints,
|
||||
clippy::create_dir,
|
||||
clippy::else_if_without_else,
|
||||
clippy::enum_glob_use,
|
||||
clippy::float_arithmetic,
|
||||
clippy::float_cmp,
|
||||
clippy::implicit_return,
|
||||
clippy::indexing_slicing,
|
||||
clippy::integer_arithmetic,
|
||||
clippy::integer_division,
|
||||
clippy::large_enum_variant,
|
||||
clippy::map_unwrap_or,
|
||||
clippy::missing_docs_in_private_items,
|
||||
clippy::missing_inline_in_public_items,
|
||||
clippy::module_name_repetitions,
|
||||
clippy::needless_lifetimes,
|
||||
clippy::needless_pass_by_value,
|
||||
clippy::non_ascii_literal,
|
||||
clippy::pattern_type_mismatch,
|
||||
clippy::shadow_reuse,
|
||||
clippy::struct_excessive_bools,
|
||||
clippy::too_many_lines,
|
||||
clippy::unseparated_literal_suffix,
|
||||
clippy::wildcard_enum_match_arm,
|
||||
clippy::wildcard_imports
|
||||
)]
|
||||
#![cfg_attr(
|
||||
any(test),
|
||||
allow(
|
||||
clippy::blacklisted_name,
|
||||
clippy::expect_fun_call,
|
||||
clippy::expect_used,
|
||||
clippy::panic,
|
||||
clippy::panic_in_result_fn,
|
||||
clippy::unwrap_in_result,
|
||||
clippy::unwrap_used
|
||||
)
|
||||
clippy::wildcard_imports,
|
||||
clippy::large_enum_variant,
|
||||
clippy::module_name_repetitions
|
||||
)]
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -57,7 +57,7 @@ impl MagnetLink {
|
|||
|
||||
if let Some(name) = &self.name {
|
||||
query.push_str("&dn=");
|
||||
query.push_str(&name);
|
||||
query.push_str(name);
|
||||
}
|
||||
|
||||
for tracker in &self.trackers {
|
||||
|
@ -86,7 +86,7 @@ impl MagnetLink {
|
|||
}
|
||||
|
||||
fn parse(text: &str) -> Result<Self, MagnetLinkParseError> {
|
||||
let url = Url::parse(&text).context(magnet_link_parse_error::Url)?;
|
||||
let url = Url::parse(text).context(magnet_link_parse_error::Url)?;
|
||||
|
||||
if url.scheme() != "magnet" {
|
||||
return Err(MagnetLinkParseError::Scheme {
|
||||
|
@ -258,7 +258,7 @@ mod tests {
|
|||
link_to.add_peer("foo.com:1337".parse().unwrap());
|
||||
link_to.add_peer("bar.net:666".parse().unwrap());
|
||||
|
||||
let link_from = MagnetLink::from_str(&link_to.to_url().to_string()).unwrap();
|
||||
let link_from = MagnetLink::from_str(link_to.to_url().as_ref()).unwrap();
|
||||
|
||||
assert_eq!(link_to, link_from);
|
||||
}
|
||||
|
@ -314,7 +314,7 @@ mod tests {
|
|||
#[test]
|
||||
fn link_from_str_topic_missing() {
|
||||
let link = "magnet:?";
|
||||
let e = MagnetLink::from_str(&link).unwrap_err();
|
||||
let e = MagnetLink::from_str(link).unwrap_err();
|
||||
|
||||
assert_matches!(e,
|
||||
Error::MagnetLinkParse {
|
||||
|
|
|
@ -56,7 +56,7 @@ impl Metainfo {
|
|||
}
|
||||
|
||||
pub(crate) fn deserialize(source: &InputTarget, data: &[u8]) -> Result<Metainfo, Error> {
|
||||
let metainfo = bendy::serde::de::from_bytes(&data).context(error::MetainfoDeserialize {
|
||||
let metainfo = bendy::serde::de::from_bytes(data).context(error::MetainfoDeserialize {
|
||||
input: source.clone(),
|
||||
})?;
|
||||
Ok(metainfo)
|
||||
|
@ -144,7 +144,7 @@ impl Metainfo {
|
|||
piece_length: Bytes(16 * 1024),
|
||||
source: Some("SOURCE".into()),
|
||||
name: "NAME".into(),
|
||||
pieces: PieceList::from_pieces(&["fae50", "fae50"]),
|
||||
pieces: PieceList::from_pieces(["fae50", "fae50"]),
|
||||
mode: Mode::Single {
|
||||
length: Bytes(32 * 1024),
|
||||
md5sum: Some(Md5Digest::from_hex("000102030405060708090a0b0c0d0e0f")),
|
||||
|
@ -192,7 +192,7 @@ impl Metainfo {
|
|||
piece_length: Bytes(1024),
|
||||
source: None,
|
||||
name: "NAME".into(),
|
||||
pieces: PieceList::from_pieces(&["fae50"]),
|
||||
pieces: PieceList::from_pieces(["fae50"]),
|
||||
mode: Mode::Single {
|
||||
length: Bytes(5),
|
||||
md5sum: None,
|
||||
|
@ -227,7 +227,7 @@ impl Metainfo {
|
|||
piece_length: Bytes(1024),
|
||||
source: None,
|
||||
name: "NAME".into(),
|
||||
pieces: PieceList::from_pieces(&["fae50"]),
|
||||
pieces: PieceList::from_pieces(["fae50"]),
|
||||
mode: Mode::Multiple {
|
||||
files: vec![FileInfo {
|
||||
length: Bytes(1024),
|
||||
|
@ -420,7 +420,7 @@ mod tests {
|
|||
fn assert_trackers_eq(metainfo: &Metainfo, want: &[&str]) {
|
||||
let want = want
|
||||
.iter()
|
||||
.cloned()
|
||||
.copied()
|
||||
.map(Url::parse)
|
||||
.collect::<Result<Vec<Url>, url::ParseError>>()
|
||||
.unwrap();
|
||||
|
|
|
@ -38,13 +38,7 @@ impl Status {
|
|||
#[cfg(test)]
|
||||
pub(crate) fn count_bad(&self) -> usize {
|
||||
match self {
|
||||
Self::Single { error, .. } => {
|
||||
if error.is_some() {
|
||||
1
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
Self::Single { error, .. } => error.is_some().into(),
|
||||
Self::Multiple { files, .. } => files.iter().filter(|file| file.is_bad()).count(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -286,7 +286,7 @@ impl Create {
|
|||
)?;
|
||||
|
||||
let mut linter = Linter::new();
|
||||
linter.allow(self.allowed_lints.iter().cloned());
|
||||
linter.allow(self.allowed_lints.iter().copied());
|
||||
|
||||
let mut announce_list = Vec::new();
|
||||
for tier in &self.announce_tiers {
|
||||
|
@ -1142,7 +1142,7 @@ mod tests {
|
|||
};
|
||||
env.assert_ok();
|
||||
let metainfo = env.load_metainfo("foo.torrent");
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(&["123"]));
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(["123"]));
|
||||
assert_eq!(
|
||||
metainfo.info.mode,
|
||||
Mode::Single {
|
||||
|
@ -1173,7 +1173,7 @@ mod tests {
|
|||
};
|
||||
env.assert_ok();
|
||||
let metainfo = env.load_metainfo("foo.torrent");
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(&["1234"]));
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(["1234"]));
|
||||
assert_eq!(
|
||||
metainfo.info.mode,
|
||||
Mode::Single {
|
||||
|
@ -1204,7 +1204,7 @@ mod tests {
|
|||
};
|
||||
env.assert_ok();
|
||||
let metainfo = env.load_metainfo("foo.torrent");
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(&["12", "34"]));
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(["12", "34"]));
|
||||
assert_eq!(
|
||||
metainfo.info.mode,
|
||||
Mode::Single {
|
||||
|
@ -1239,7 +1239,7 @@ mod tests {
|
|||
};
|
||||
env.assert_ok();
|
||||
let metainfo = env.load_metainfo("dir.torrent");
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(&["56781234"]));
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(["56781234"]));
|
||||
assert_eq!(
|
||||
metainfo.info.mode,
|
||||
Mode::Multiple {
|
||||
|
@ -1276,7 +1276,7 @@ mod tests {
|
|||
};
|
||||
env.assert_ok();
|
||||
let metainfo = env.load_metainfo("foo.torrent");
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(&["bar"]));
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(["bar"]));
|
||||
assert_eq!(
|
||||
metainfo.info.mode,
|
||||
Mode::Single {
|
||||
|
@ -1309,7 +1309,7 @@ mod tests {
|
|||
let metainfo = env.load_metainfo("foo.torrent");
|
||||
assert_eq!(
|
||||
metainfo.info.pieces,
|
||||
PieceList::from_pieces(&["b", "a", "r"])
|
||||
PieceList::from_pieces(["b", "a", "r"])
|
||||
);
|
||||
assert_eq!(
|
||||
metainfo.info.mode,
|
||||
|
@ -1388,7 +1388,7 @@ mod tests {
|
|||
};
|
||||
env.assert_ok();
|
||||
let metainfo = env.load_metainfo("foo.torrent");
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(&["bar"]));
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(["bar"]));
|
||||
match metainfo.info.mode {
|
||||
Mode::Multiple { files } => {
|
||||
assert_eq!(
|
||||
|
@ -1400,7 +1400,7 @@ mod tests {
|
|||
},]
|
||||
);
|
||||
}
|
||||
_ => panic!("Expected multi-file torrent"),
|
||||
Mode::Single { .. } => panic!("Expected multi-file torrent"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1423,7 +1423,7 @@ mod tests {
|
|||
};
|
||||
env.assert_ok();
|
||||
let metainfo = env.load_metainfo("foo.torrent");
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(&["bar"]));
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(["bar"]));
|
||||
match metainfo.info.mode {
|
||||
Mode::Multiple { files } => {
|
||||
assert_eq!(
|
||||
|
@ -1435,7 +1435,7 @@ mod tests {
|
|||
},]
|
||||
);
|
||||
}
|
||||
_ => panic!("Expected multi-file torrent"),
|
||||
Mode::Single { .. } => panic!("Expected multi-file torrent"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1461,7 +1461,7 @@ mod tests {
|
|||
};
|
||||
env.assert_ok();
|
||||
let metainfo = env.load_metainfo("foo.torrent");
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(&["abchijxyz"]));
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(["abchijxyz"]));
|
||||
match metainfo.info.mode {
|
||||
Mode::Multiple { files } => {
|
||||
assert_eq!(
|
||||
|
@ -1485,7 +1485,7 @@ mod tests {
|
|||
]
|
||||
);
|
||||
}
|
||||
_ => panic!("Expected multi-file torrent"),
|
||||
Mode::Single { .. } => panic!("Expected multi-file torrent"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1792,7 +1792,7 @@ Content Size 9 bytes
|
|||
metainfo.info.mode,
|
||||
Mode::Multiple { files } if files.len() == 2
|
||||
);
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(&["abcabc"]));
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(["abcabc"]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1876,7 +1876,7 @@ Content Size 9 bytes
|
|||
metainfo.info.mode,
|
||||
Mode::Multiple { files } if files.len() == 2
|
||||
);
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(&["abcabc"]));
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(["abcabc"]));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -1977,7 +1977,7 @@ Content Size 9 bytes
|
|||
]
|
||||
);
|
||||
}
|
||||
_ => panic!("Expected multi-file torrent"),
|
||||
Mode::Single { .. } => panic!("Expected multi-file torrent"),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -2236,7 +2236,7 @@ Content Size 9 bytes
|
|||
metainfo.info.mode,
|
||||
Mode::Multiple { files } if files.len() == 1
|
||||
);
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(&["yyy"]));
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(["yyy"]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -2268,7 +2268,7 @@ Content Size 9 bytes
|
|||
metainfo.info.mode,
|
||||
Mode::Multiple { files } if files.len() == 1
|
||||
);
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(&["yyy"]));
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(["yyy"]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -2302,7 +2302,7 @@ Content Size 9 bytes
|
|||
metainfo.info.mode,
|
||||
Mode::Multiple { files } if files.len() == 1
|
||||
);
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(&["a"]));
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(["a"]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -2871,7 +2871,7 @@ Content Size 9 bytes
|
|||
|
||||
let metainfo = env.load_metainfo("foo.torrent");
|
||||
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(&["hello"]));
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(["hello"]));
|
||||
|
||||
assert_eq!(
|
||||
metainfo.info.mode,
|
||||
|
@ -3073,7 +3073,7 @@ Content Size 9 bytes
|
|||
let bytes = env.out_bytes();
|
||||
let metainfo = Metainfo::from_bytes(&bytes);
|
||||
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(&["hello"]));
|
||||
assert_eq!(metainfo.info.pieces, PieceList::from_pieces(["hello"]));
|
||||
|
||||
assert_eq!(
|
||||
metainfo.info.mode,
|
||||
|
|
|
@ -56,7 +56,7 @@ impl Stats {
|
|||
for result in WalkBuilder::new(path)
|
||||
.standard_filters(false)
|
||||
.hidden(true)
|
||||
.sort_by_file_name(|a, b| a.cmp(b))
|
||||
.sort_by_file_name(Ord::cmp)
|
||||
.build()
|
||||
{
|
||||
if extractor.torrents >= self.limit.unwrap_or(u64::max_value()) {
|
||||
|
@ -158,7 +158,7 @@ impl Extractor {
|
|||
|
||||
self.torrents += 1;
|
||||
|
||||
let contents = if let Ok(contents) = fs::read(&path) {
|
||||
let contents = if let Ok(contents) = fs::read(path) {
|
||||
contents
|
||||
} else {
|
||||
self.io_errors += 1;
|
||||
|
|
|
@ -503,7 +503,7 @@ mod tests {
|
|||
use std::os::unix::fs::PermissionsExt;
|
||||
let metadata = create_env.metadata("foo/t");
|
||||
let mut permissions = metadata.permissions();
|
||||
permissions.set_mode(0);
|
||||
permissions.set_mode(0o0);
|
||||
create_env.set_permissions("foo/t", permissions);
|
||||
}
|
||||
|
||||
|
@ -599,7 +599,7 @@ mod tests {
|
|||
use std::os::unix::fs::PermissionsExt;
|
||||
let metadata = create_env.metadata("foo/t");
|
||||
let mut permissions = metadata.permissions();
|
||||
permissions.set_mode(0);
|
||||
permissions.set_mode(0o0);
|
||||
create_env.set_permissions("foo/t", permissions);
|
||||
}
|
||||
|
||||
|
|
18
src/table.rs
18
src/table.rs
|
@ -94,7 +94,7 @@ impl Table {
|
|||
}
|
||||
}
|
||||
Value::Directory { root, files } => {
|
||||
let mut tree = Tree::new(&root);
|
||||
let mut tree = Tree::new(root);
|
||||
for file in files {
|
||||
tree.insert(file.components());
|
||||
}
|
||||
|
@ -273,18 +273,22 @@ mod tests {
|
|||
.write_human_readable(&mut cursor, Style::inactive())
|
||||
.unwrap();
|
||||
let have = String::from_utf8(cursor.into_inner()).unwrap();
|
||||
if have != want {
|
||||
panic!("have != want:\nHAVE:\n{}\nWANT:\n{}", have, want);
|
||||
}
|
||||
assert_eq!(
|
||||
have, want,
|
||||
"have != want:\nHAVE:\n{}\nWANT:\n{}",
|
||||
have, want
|
||||
);
|
||||
}
|
||||
|
||||
fn tab_delimited(table: &Table, want: &str) {
|
||||
let mut cursor = Cursor::new(Vec::new());
|
||||
table.write_tab_delimited(&mut cursor).unwrap();
|
||||
let have = String::from_utf8(cursor.into_inner()).unwrap();
|
||||
if have != want {
|
||||
panic!("have != want:\nHAVE:\n{}\nWANT:\n{}", have, want);
|
||||
}
|
||||
assert_eq!(
|
||||
have, want,
|
||||
"have != want:\nHAVE:\n{}\nWANT:\n{}",
|
||||
have, want
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -49,7 +49,7 @@ impl TestEnvBuilder {
|
|||
}
|
||||
|
||||
pub(crate) fn arg_slice(mut self, args: &[&str]) -> Self {
|
||||
for arg in args.iter().cloned() {
|
||||
for arg in args.iter().copied() {
|
||||
self.args.push(arg.into());
|
||||
}
|
||||
self
|
||||
|
|
|
@ -42,8 +42,8 @@ impl<'a> Verifier<'a> {
|
|||
fn verify_metainfo(mut self) -> Status {
|
||||
match &self.metainfo.info.mode {
|
||||
Mode::Single { length, md5sum } => {
|
||||
self.hash(&self.base).ok();
|
||||
let error = FileError::verify(&self.base, *length, *md5sum).err();
|
||||
self.hash(self.base).ok();
|
||||
let error = FileError::verify(self.base, *length, *md5sum).err();
|
||||
|
||||
let pieces = self.finish();
|
||||
Status::single(pieces, error)
|
||||
|
|
|
@ -114,7 +114,7 @@ impl Walker {
|
|||
let path = entry.path();
|
||||
|
||||
if let Some(s) = &self.spinner {
|
||||
let display_path = path.strip_prefix(&self.root).unwrap_or(&path);
|
||||
let display_path = path.strip_prefix(&self.root).unwrap_or(path);
|
||||
s.set_message(&display_path.display().to_string());
|
||||
s.tick();
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ impl Walker {
|
|||
});
|
||||
}
|
||||
|
||||
if !self.pattern_filter(&relative) {
|
||||
if !self.pattern_filter(relative) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,10 @@ if [ -z ${dst-} ]; then
|
|||
fi
|
||||
|
||||
if [ -z ${tag-} ]; then
|
||||
tag=$(curl -s "$releases/latest" | cut -d'"' -f2 | rev | cut -d'/' -f1 | rev)
|
||||
tag=$(curl --proto =https --tlsv1.2 -sSf https://api.github.com/repos/casey/intermodal/releases/latest |
|
||||
grep tag_name |
|
||||
cut -d'"' -f4
|
||||
)
|
||||
fi
|
||||
|
||||
archive="$releases/download/$tag/$crate-$tag-$target.tar.gz"
|
||||
|
@ -108,7 +111,7 @@ say_err "Destination: $dst"
|
|||
say_err "Archive: $archive"
|
||||
|
||||
td=$(mktemp -d || mktemp -d -t tmp)
|
||||
curl -sL $archive | tar -C $td -xz
|
||||
curl --proto =https --tlsv1.2 -sSfL $archive | tar -C $td -xz
|
||||
|
||||
if [ -e "$dst/$bin" ] && [ $force = false ]; then
|
||||
err "$bin already exists in $dst"
|
||||
|
|
Loading…
Reference in a new issue