summaryrefslogtreecommitdiffstats
path: root/tool
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2019-09-26 11:53:32 +0200
committerNeal H. Walfield <neal@pep.foundation>2019-09-27 22:12:11 +0200
commit424ce126a56660168f8284fa34ae80cb93d74289 (patch)
tree2c0440c1f3b0d557def5e1a496ee4ede22045a9b /tool
parenta69ec9f9c5097bb8acd1a4fe2144328c9dc4ade7 (diff)
linting: Clear up bare trait object warnings
Newer Rust compilers requre `dyn` marking trait objects. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'tool')
-rw-r--r--tool/src/commands/decrypt.rs4
-rw-r--r--tool/src/commands/inspect.rs12
-rw-r--r--tool/src/commands/mod.rs14
-rw-r--r--tool/src/commands/sign.rs8
-rw-r--r--tool/src/sq.rs8
5 files changed, 23 insertions, 23 deletions
diff --git a/tool/src/commands/decrypt.rs b/tool/src/commands/decrypt.rs
index 2b0bc0c2..3e942fe4 100644
--- a/tool/src/commands/decrypt.rs
+++ b/tool/src/commands/decrypt.rs
@@ -96,7 +96,7 @@ impl<'a> Helper<'a> {
/// Tries to decrypt the given PKESK packet with `keypair` and try
/// to decrypt the packet parser using `decrypt`.
fn try_decrypt<D>(&self, pkesk: &PKESK,
- keypair: &mut crypto::Decryptor<key::UnspecifiedRole>,
+ keypair: &mut dyn crypto::Decryptor<key::UnspecifiedRole>,
decrypt: &mut D)
-> openpgp::Result<Option<Fingerprint>>
where D: FnMut(SymmetricAlgorithm, &SessionKey) -> openpgp::Result<()>
@@ -293,7 +293,7 @@ impl<'a> DecryptionHelper for Helper<'a> {
}
pub fn decrypt(ctx: &Context, mapping: &mut store::Mapping,
- input: &mut io::Read, output: &mut io::Write,
+ input: &mut dyn io::Read, output: &mut dyn io::Write,
signatures: usize, tpks: Vec<TPK>, secrets: Vec<TPK>,
dump_session_key: bool,
dump: bool, hex: bool)
diff --git a/tool/src/commands/inspect.rs b/tool/src/commands/inspect.rs
index 77694b0e..ee915c54 100644
--- a/tool/src/commands/inspect.rs
+++ b/tool/src/commands/inspect.rs
@@ -9,7 +9,7 @@ use crate::openpgp::parse::{Parse, PacketParserResult};
use super::TIMEFMT;
-pub fn inspect(m: &clap::ArgMatches, output: &mut io::Write)
+pub fn inspect(m: &clap::ArgMatches, output: &mut dyn io::Write)
-> Result<()> {
let print_keygrips = m.is_present("keygrips");
let print_certifications = m.is_present("certifications");
@@ -124,7 +124,7 @@ pub fn inspect(m: &clap::ArgMatches, output: &mut io::Write)
Ok(())
}
-fn inspect_tpk(output: &mut io::Write, tpk: &openpgp::TPK,
+fn inspect_tpk(output: &mut dyn io::Write, tpk: &openpgp::TPK,
print_keygrips: bool, print_certifications: bool) -> Result<()> {
writeln!(output, "Transferable {} Key.",
if tpk.is_tsk() { "Secret" } else { "Public" })?;
@@ -164,7 +164,7 @@ fn inspect_tpk(output: &mut io::Write, tpk: &openpgp::TPK,
Ok(())
}
-fn inspect_key<P, R>(output: &mut io::Write,
+fn inspect_key<P, R>(output: &mut dyn io::Write,
indent: &str,
key: &openpgp::packet::Key<P, R>,
binding_signature: Option<&openpgp::packet::Signature>,
@@ -211,7 +211,7 @@ fn inspect_key<P, R>(output: &mut io::Write,
Ok(())
}
-fn inspect_revocation(output: &mut io::Write,
+fn inspect_revocation(output: &mut dyn io::Write,
indent: &str,
revoked: openpgp::RevocationStatus)
-> Result<()> {
@@ -252,7 +252,7 @@ fn inspect_key_flags(flags: openpgp::constants::KeyFlags) -> Option<String> {
}
}
-fn inspect_signatures(output: &mut io::Write,
+fn inspect_signatures(output: &mut dyn io::Write,
sigs: &[openpgp::packet::Signature]) -> Result<()> {
use crate::openpgp::constants::SignatureType::*;
for sig in sigs {
@@ -276,7 +276,7 @@ fn inspect_signatures(output: &mut io::Write,
Ok(())
}
-fn inspect_certifications(output: &mut io::Write,
+fn inspect_certifications(output: &mut dyn io::Write,
certs: &[openpgp::packet::Signature],
print_certifications: bool) -> Result<()> {
if print_certifications {
diff --git a/tool/src/commands/mod.rs b/tool/src/commands/mod.rs
index 37f0852f..c637da4a 100644
--- a/tool/src/commands/mod.rs
+++ b/tool/src/commands/mod.rs
@@ -85,7 +85,7 @@ fn get_signing_keys(tpks: &[openpgp::TPK])
}
pub fn encrypt(mapping: &mut store::Mapping,
- input: &mut io::Read, output: &mut io::Write,
+ input: &mut dyn io::Read, output: &mut dyn io::Write,
npasswords: usize, recipients: Vec<&str>,
mut tpks: Vec<openpgp::TPK>, signers: Vec<openpgp::TPK>,
mode: openpgp::constants::KeyFlags,
@@ -363,9 +363,9 @@ impl<'a> VerificationHelper for VHelper<'a> {
}
pub fn verify(ctx: &Context, mapping: &mut store::Mapping,
- input: &mut io::Read,
- detached: Option<&mut io::Read>,
- output: &mut io::Write,
+ input: &mut dyn io::Read,
+ detached: Option<&mut dyn io::Read>,
+ output: &mut dyn io::Write,
signatures: usize, tpks: Vec<TPK>)
-> Result<()> {
let helper = VHelper::new(ctx, mapping, signatures, tpks);
@@ -388,7 +388,7 @@ pub fn verify(ctx: &Context, mapping: &mut store::Mapping,
Ok(())
}
-pub fn split(input: &mut io::Read, prefix: &str)
+pub fn split(input: &mut dyn io::Read, prefix: &str)
-> Result<()> {
// We (ab)use the mapping feature to create byte-accurate dumps of
// nested packets.
@@ -434,11 +434,11 @@ pub fn split(input: &mut io::Read, prefix: &str)
}
/// Joins the given files.
-pub fn join(inputs: Option<clap::Values>, output: &mut io::Write)
+pub fn join(inputs: Option<clap::Values>, output: &mut dyn io::Write)
-> Result<()> {
/// Writes a bit-accurate copy of all top-level packets in PPR to
/// OUTPUT.
- fn copy(mut ppr: PacketParserResult, output: &mut io::Write)
+ fn copy(mut ppr: PacketParserResult, output: &mut dyn io::Write)
-> Result<()> {
while let PacketParserResult::Some(pp) = ppr {
// We (ab)use the mapping feature to create byte-accurate
diff --git a/tool/src/commands/sign.rs b/tool/src/commands/sign.rs
index e56ff190..1b2c98b3 100644
--- a/tool/src/commands/sign.rs
+++ b/tool/src/commands/sign.rs
@@ -19,7 +19,7 @@ use crate::openpgp::serialize::stream::{
};
use crate::create_or_stdout;
-pub fn sign(input: &mut io::Read, output_path: Option<&str>,
+pub fn sign(input: &mut dyn io::Read, output_path: Option<&str>,
secrets: Vec<openpgp::TPK>, detached: bool, binary: bool,
append: bool, notarize: bool, force: bool)
-> Result<()> {
@@ -32,12 +32,12 @@ pub fn sign(input: &mut io::Read, output_path: Option<&str>,
}
}
-fn sign_data(input: &mut io::Read, output_path: Option<&str>,
+fn sign_data(input: &mut dyn io::Read, output_path: Option<&str>,
secrets: Vec<openpgp::TPK>, detached: bool, binary: bool,
append: bool, force: bool)
-> Result<()> {
let (mut output, prepend_sigs, tmp_path):
- (Box<io::Write>, Vec<Signature>, Option<PathBuf>) =
+ (Box<dyn io::Write>, Vec<Signature>, Option<PathBuf>) =
if detached && append && output_path.is_some() {
// First, read the existing signatures.
let mut sigs = Vec::new();
@@ -126,7 +126,7 @@ fn sign_data(input: &mut io::Read, output_path: Option<&str>,
Ok(())
}
-fn sign_message(input: &mut io::Read, output_path: Option<&str>,
+fn sign_message(input: &mut dyn io::Read, output_path: Option<&str>,
secrets: Vec<openpgp::TPK>, binary: bool, notarize: bool,
force: bool)
-> Result<()> {
diff --git a/tool/src/sq.rs b/tool/src/sq.rs
index 78e571d3..ccc56738 100644
--- a/tool/src/sq.rs
+++ b/tool/src/sq.rs
@@ -37,7 +37,7 @@ use store::{Mapping, LogIter};
mod sq_cli;
mod commands;
-fn open_or_stdin(f: Option<&str>) -> Result<Box<io::Read>, failure::Error> {
+fn open_or_stdin(f: Option<&str>) -> Result<Box<dyn io::Read>, failure::Error> {
match f {
Some(f) => Ok(Box::new(File::open(f)
.context("Failed to open input file")?)),
@@ -46,7 +46,7 @@ fn open_or_stdin(f: Option<&str>) -> Result<Box<io::Read>, failure::Error> {
}
fn create_or_stdout(f: Option<&str>, force: bool)
- -> Result<Box<io::Write>, failure::Error> {
+ -> Result<Box<dyn io::Write>, failure::Error> {
match f {
None => Ok(Box::new(io::stdout())),
Some(p) if p == "-" => Ok(Box::new(io::stdout())),
@@ -79,7 +79,7 @@ fn load_tpks<'a, I>(files: I) -> openpgp::Result<Vec<TPK>>
}
/// Serializes a keyring, adding descriptive headers if armored.
-fn serialize_keyring(mut output: &mut io::Write, tpks: &[TPK], binary: bool)
+fn serialize_keyring(mut output: &mut dyn io::Write, tpks: &[TPK], binary: bool)
-> openpgp::Result<()> {
// Handle the easy options first. No armor no cry:
if binary {
@@ -253,7 +253,7 @@ fn real_main() -> Result<(), failure::Error> {
let mut mapping = Mapping::open(&ctx, realm_name, mapping_name)
.context("Failed to open the mapping")?;
commands::verify(&ctx, &mut mapping, &mut input,
- detached.as_mut().map(|r| r as &mut io::Read),
+ detached.as_mut().map(|r| r as &mut dyn io::Read),
&mut output, signatures, tpks)?;
},