Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Rust Edition 2021 #302

Merged
merged 1 commit into from
Oct 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ authors = ["brycx <[email protected]>"]
description = "Usable, easy and safe pure-Rust crypto"
keywords = [ "cryptography", "crypto", "aead", "hash", "mac" ]
categories = [ "cryptography", "no-std" ]
edition = "2018"
rust-version = "1.57" # Update CI test along with this.
edition = "2021"
rust-version = "1.57" # Update CI (MSRV) test along with this.
readme = "README.md"
repository = "https://github.com/orion-rs/orion"
documentation = "https://docs.rs/orion"
Expand Down
6 changes: 1 addition & 5 deletions src/hazardous/ecc/x25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,6 @@ pub struct PublicKey {

impl PartialEq<&[u8]> for PublicKey {
fn eq(&self, other: &&[u8]) -> bool {
use core::convert::TryInto;

if other.len() != PUBLIC_KEY_SIZE {
return false;
}
Expand All @@ -413,7 +411,7 @@ impl_try_from_trait!(PublicKey);
#[cfg(feature = "serde")]
impl_serde_traits!(PublicKey, to_bytes);

impl core::convert::TryFrom<&PrivateKey> for PublicKey {
impl TryFrom<&PrivateKey> for PublicKey {
type Error = UnknownCryptoError;

fn try_from(private_key: &PrivateKey) -> Result<Self, Self::Error> {
Expand All @@ -431,8 +429,6 @@ impl PublicKey {
#[must_use = "SECURITY WARNING: Ignoring a Result can have real security implications."]
/// Construct from a given byte slice.
pub fn from_slice(slice: &[u8]) -> Result<Self, UnknownCryptoError> {
use core::convert::TryInto;

let slice_len = slice.len();

if slice_len != PUBLIC_KEY_SIZE {
Expand Down
2 changes: 1 addition & 1 deletion src/typedefs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ macro_rules! impl_from_trait (($name:ident, $size:expr) => (
/// implements the method `from_slice`.
macro_rules! impl_try_from_trait (($name:ident) => (
/// Delegates to `from_slice` implementation
impl core::convert::TryFrom<&[u8]> for $name {
impl TryFrom<&[u8]> for $name {
type Error = UnknownCryptoError;
fn try_from(slice: &[u8]) -> Result<Self, Self::Error> {
Self::from_slice(slice)
Expand Down