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

chore(general): Rust 2024 edition #218

Closed
wants to merge 6 commits into from
Closed
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 rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
resolver = "2"
resolver = "3"
members = [
"c509-certificate",
"cardano-blockchain-types",
Expand All @@ -19,7 +19,7 @@ members = [
]

[workspace.package]
edition = "2021"
edition = "2024"
authors = ["Steven Johnson <[email protected]>"]
homepage = "https://github.com/input-output-hk/catalyst-libs"
repository = "https://github.com/input-output-hk/catalyst-libs"
Expand Down
3 changes: 2 additions & 1 deletion rust/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.2.37 AS rust-ci
# TODO: FIXME: Use release instead of branch
IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:2024-edition AS rust-ci
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be cahnged.


COPY_SRC:
FUNCTION
Expand Down
2 changes: 1 addition & 1 deletion rust/c509-certificate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ ignored = ["strum"]
[dev-dependencies]
clap = { version = "4.5.23", features = ["derive"] }
serde_json = "1.0.134"
rand = "0.8.5"
rand = "0.9.0"
chrono = "0.4.39"

[[example]]
Expand Down
6 changes: 3 additions & 3 deletions rust/c509-certificate/examples/cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{
path::PathBuf,
};

use asn1_rs::{oid, Oid};
use asn1_rs::{Oid, oid};
use c509_certificate::{
attributes::attribute::Attribute,
big_uint::UnwrappedBigUint,
Expand Down Expand Up @@ -131,7 +131,7 @@ struct C509Json {
}

/// Ed25519 oid and parameter - default algorithm.
const ED25519: (Oid, Option<String>) = (oid!(1.3.101 .112), None);
const ED25519: (Oid, Option<String>) = (oid!(1.3.101.112), None);

/// Integer indicate that certificate is self-signed.
/// 2 for Natively Signed C509 Certificate following X.509 v3
Expand Down Expand Up @@ -277,7 +277,7 @@ fn parse_or_default_date(date_option: Option<String>, default: u64) -> Result<u6

/// Generate random serial number if not provided
fn parse_serial_number(serial_number: Option<UnwrappedBigUint>) -> UnwrappedBigUint {
let random_number: u64 = rand::thread_rng().gen();
let random_number: u64 = rand::rng().random();
serial_number.unwrap_or(UnwrappedBigUint::new(random_number))
}

Expand Down
2 changes: 1 addition & 1 deletion rust/c509-certificate/src/algorithm_identifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//! visit [C509 Certificate](https://datatracker.ietf.org/doc/draft-ietf-cose-cbor-encoded-cert/11/)

use asn1_rs::Oid;
use minicbor::{encode::Write, Decode, Decoder, Encode, Encoder};
use minicbor::{Decode, Decoder, Encode, Encoder, encode::Write};
use serde::{Deserialize, Serialize};

use crate::{
Expand Down
8 changes: 4 additions & 4 deletions rust/c509-certificate/src/attributes/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
use std::str::FromStr;

use asn1_rs::Oid;
use minicbor::{encode::Write, Decode, Decoder, Encode, Encoder};
use minicbor::{Decode, Decoder, Encode, Encoder, encode::Write};
use serde::{Deserialize, Deserializer, Serialize};

use super::data::{get_oid_from_int, ATTRIBUTES_LOOKUP};
use super::data::{ATTRIBUTES_LOOKUP, get_oid_from_int};
use crate::{
helper::{
decode::{decode_array_len, decode_datatype, decode_helper},
Expand Down Expand Up @@ -241,7 +241,7 @@ mod test_attribute {
fn encode_decode_attribute_int() {
let mut buffer = Vec::new();
let mut encoder = Encoder::new(&mut buffer);
let mut attribute = Attribute::new(oid!(1.2.840 .113549 .1 .9 .1));
let mut attribute = Attribute::new(oid!(1.2.840.113549.1.9.1));
attribute.add_value(AttributeValue::Text("[email protected]".to_string()));
attribute
.encode(&mut encoder, &mut ())
Expand All @@ -263,7 +263,7 @@ mod test_attribute {
fn empty_attribute_value() {
let mut buffer = Vec::new();
let mut encoder = Encoder::new(&mut buffer);
let attribute = Attribute::new(oid!(1.2.840 .113549 .1 .9 .1));
let attribute = Attribute::new(oid!(1.2.840.113549.1.9.1));
attribute
.encode(&mut encoder, &mut ())
.expect_err("Failed to encode Attribute");
Expand Down
2 changes: 1 addition & 1 deletion rust/c509-certificate/src/attributes/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Section 9.3 C509 Attributes Registry for more information.

use anyhow::Error;
use asn1_rs::{oid, Oid};
use asn1_rs::{Oid, oid};
use once_cell::sync::Lazy;

use crate::tables::IntegerToOidTable;
Expand Down
4 changes: 2 additions & 2 deletions rust/c509-certificate/src/attributes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//! visit [C509 Certificate](https://datatracker.ietf.org/doc/draft-ietf-cose-cbor-encoded-cert/11/)

use attribute::Attribute;
use minicbor::{encode::Write, Decode, Decoder, Encode, Encoder};
use minicbor::{Decode, Decoder, Encode, Encoder, encode::Write};
use serde::{Deserialize, Serialize};

use crate::helper::{decode::decode_array_len, encode::encode_array_len};
Expand Down Expand Up @@ -105,7 +105,7 @@ mod test_attributes {
fn encode_decode_attributes_int() {
let mut buffer = Vec::new();
let mut encoder = Encoder::new(&mut buffer);
let mut attr = Attribute::new(oid!(1.2.840 .113549 .1 .9 .1));
let mut attr = Attribute::new(oid!(1.2.840.113549.1.9.1));
attr.add_value(AttributeValue::Text("[email protected]".to_string()));
attr.add_value(AttributeValue::Text("[email protected]".to_string()));
let mut attributes = Attributes::new();
Expand Down
2 changes: 1 addition & 1 deletion rust/c509-certificate/src/big_uint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// cspell: words Bignum bignum biguint

use minicbor::{encode::Write, Decode, Decoder, Encode, Encoder};
use minicbor::{Decode, Decoder, Encode, Encoder, encode::Write};
use serde::{Deserialize, Serialize};

use crate::helper::{decode::decode_bytes, encode::encode_bytes};
Expand Down
2 changes: 1 addition & 1 deletion rust/c509-certificate/src/c509.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! C509 Certificate

use minicbor::{encode::Write, Decode, Decoder, Encode, Encoder};
use minicbor::{Decode, Decoder, Encode, Encoder, encode::Write};
use serde::{Deserialize, Serialize};

use crate::{
Expand Down
Loading
Loading