diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2019-09-26 11:53:32 +0200 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2019-09-27 22:12:11 +0200 |
commit | 424ce126a56660168f8284fa34ae80cb93d74289 (patch) | |
tree | 2c0440c1f3b0d557def5e1a496ee4ede22045a9b /openpgp-ffi | |
parent | a69ec9f9c5097bb8acd1a4fe2144328c9dc4ade7 (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 'openpgp-ffi')
-rw-r--r-- | openpgp-ffi/src/armor.rs | 2 | ||||
-rw-r--r-- | openpgp-ffi/src/crypto.rs | 6 | ||||
-rw-r--r-- | openpgp-ffi/src/io.rs | 12 | ||||
-rw-r--r-- | openpgp-ffi/src/serialize.rs | 4 | ||||
-rw-r--r-- | openpgp-ffi/src/tpk.rs | 6 |
5 files changed, 15 insertions, 15 deletions
diff --git a/openpgp-ffi/src/armor.rs b/openpgp-ffi/src/armor.rs index 008bcf01..4ce8187d 100644 --- a/openpgp-ffi/src/armor.rs +++ b/openpgp-ffi/src/armor.rs @@ -386,7 +386,7 @@ pub extern "C" fn pgp_armor_writer_new header_.iter().map(|h| (h.0.as_ref(), h.1.as_ref())).collect(); armor::Writer::new(inner, kind, &header) - .map(|w| -> Box<io::Write> { Box::new(w) }) + .map(|w| -> Box<dyn io::Write> { Box::new(w) }) .map_err(|e| ::failure::Error::from(e)) .move_into_raw(errp) } diff --git a/openpgp-ffi/src/crypto.rs b/openpgp-ffi/src/crypto.rs index 5cd736b7..41c58504 100644 --- a/openpgp-ffi/src/crypto.rs +++ b/openpgp-ffi/src/crypto.rs @@ -58,7 +58,7 @@ fn pgp_password_from_bytes(buf: *const u8, size: size_t) -> *mut Password { /// Frees a signer. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signer_free - (s: Option<&mut &'static mut crypto::Signer< + (s: Option<&mut &'static mut dyn crypto::Signer< openpgp::packet::key::UnspecifiedRole>>) { ffi_free!(s) @@ -92,10 +92,10 @@ pub extern "C" fn pgp_key_pair_free #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_key_pair_as_signer (kp: *mut crypto::KeyPair<openpgp::packet::key::UnspecifiedRole>) - -> *mut &'static mut crypto::Signer<openpgp::packet::key::UnspecifiedRole> + -> *mut &'static mut dyn crypto::Signer<openpgp::packet::key::UnspecifiedRole> { let kp = ffi_param_ref_mut!(kp); - let signer: &mut crypto::Signer<_> = kp; + let signer: &mut dyn crypto::Signer<_> = kp; box_raw!(signer) //box_raw!(kp) } diff --git a/openpgp-ffi/src/io.rs b/openpgp-ffi/src/io.rs index 2d873561..f0314e19 100644 --- a/openpgp-ffi/src/io.rs +++ b/openpgp-ffi/src/io.rs @@ -25,7 +25,7 @@ pub struct Reader(ReaderKind); /// In some cases, we want to call functions on concrete types. To /// avoid nasty hacks, we have specialized variants for that. pub(crate) enum ReaderKind { - Generic(Box<io::Read>), + Generic(Box<dyn io::Read>), Armored(openpgp::armor::Reader<'static>), } @@ -138,7 +138,7 @@ pub extern "C" fn pgp_reader_discard(errp: Option<&mut *mut crate::error::Error> /// Wraps a generic writer. #[crate::ffi_wrapper_type(prefix = "pgp_")] -pub struct Writer(Box<io::Write>); +pub struct Writer(Box<dyn io::Write>); /// Opens a file returning a writer. /// @@ -150,7 +150,7 @@ fn pgp_writer_from_file(errp: Option<&mut *mut crate::error::Error>, -> Maybe<Writer> { let filename = ffi_param_cstr!(filename).to_string_lossy().into_owned(); File::create(Path::new(&filename)) - .map(|w| -> Box<io::Write> { Box::new(w) }) + .map(|w| -> Box<dyn io::Write> { Box::new(w) }) .map_err(|e| ::failure::Error::from(e)) .move_into_raw(errp) } @@ -159,7 +159,7 @@ fn pgp_writer_from_file(errp: Option<&mut *mut crate::error::Error>, #[cfg(unix)] #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_writer_from_fd(fd: c_int) -> *mut Writer { - let w: Box<io::Write> = Box::new(unsafe { File::from_raw_fd(fd) }); + let w: Box<dyn io::Write> = Box::new(unsafe { File::from_raw_fd(fd) }); w.move_into_raw() } @@ -170,7 +170,7 @@ fn pgp_writer_from_bytes(buf: *mut u8, len: size_t) -> *mut Writer { let buf = unsafe { slice::from_raw_parts_mut(buf, len as usize) }; - let w: Box<io::Write> = Box::new(Cursor::new(buf)); + let w: Box<dyn io::Write> = Box::new(Cursor::new(buf)); w.move_into_raw() } @@ -188,7 +188,7 @@ fn pgp_writer_alloc(buf: *mut *mut c_void, len: *mut size_t) let buf = ffi_param_ref_mut!(buf); let len = ffi_param_ref_mut!(len); - let w: Box<io::Write> = Box::new(WriterAlloc { + let w: Box<dyn io::Write> = Box::new(WriterAlloc { buf: buf, len: len, }); diff --git a/openpgp-ffi/src/serialize.rs b/openpgp-ffi/src/serialize.rs index 9613886c..918c30fb 100644 --- a/openpgp-ffi/src/serialize.rs +++ b/openpgp-ffi/src/serialize.rs @@ -150,7 +150,7 @@ pub extern "C" fn pgp_arbitrary_writer_new pub extern "C" fn pgp_signer_new (errp: Option<&mut *mut crate::error::Error>, inner: *mut writer::Stack<'static, Cookie>, - signers: *const *mut Box<self::openpgp::crypto::Signer< + signers: *const *mut Box<dyn self::openpgp::crypto::Signer< self::openpgp::packet::key::UnspecifiedRole>>, signers_len: size_t, hash_algo: u8) @@ -183,7 +183,7 @@ pub extern "C" fn pgp_signer_new pub extern "C" fn pgp_signer_new_detached (errp: Option<&mut *mut crate::error::Error>, inner: *mut writer::Stack<'static, Cookie>, - signers: *const *mut Box<self::openpgp::crypto::Signer< + signers: *const *mut Box<dyn self::openpgp::crypto::Signer< self::openpgp::packet::key::UnspecifiedRole>>, signers_len: size_t, hash_algo: u8) diff --git a/openpgp-ffi/src/tpk.rs b/openpgp-ffi/src/tpk.rs index b11f4f88..bfac7597 100644 --- a/openpgp-ffi/src/tpk.rs +++ b/openpgp-ffi/src/tpk.rs @@ -238,7 +238,7 @@ fn int_to_reason_for_revocation(code: c_int) -> ReasonForRevocation { #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_tpk_revoke(errp: Option<&mut *mut crate::error::Error>, tpk: *const TPK, - primary_signer: *mut Box<crypto::Signer< + primary_signer: *mut Box<dyn crypto::Signer< openpgp::packet::key::UnspecifiedRole>>, code: c_int, reason: Option<&c_char>) @@ -305,7 +305,7 @@ fn pgp_tpk_revoke(errp: Option<&mut *mut crate::error::Error>, #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_tpk_revoke_in_place(errp: Option<&mut *mut crate::error::Error>, tpk: *mut TPK, - primary_signer: *mut Box<crypto::Signer< + primary_signer: *mut Box<dyn crypto::Signer< openpgp::packet::key::UnspecifiedRole>>, code: c_int, reason: Option<&c_char>) @@ -360,7 +360,7 @@ fn pgp_tpk_alive(tpk: *const TPK, when: time_t) /// This function consumes `tpk` and returns a new `TPK`. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_tpk_set_expiry(errp: Option<&mut *mut crate::error::Error>, - tpk: *mut TPK, primary_signer: *mut Box<crypto::Signer< + tpk: *mut TPK, primary_signer: *mut Box<dyn crypto::Signer< openpgp::packet::key::UnspecifiedRole>>, expiry: u32) -> Maybe<TPK> { |