Skip to content

Commit

Permalink
Upgrade to Rust 1.72.0
Browse files Browse the repository at this point in the history
  • Loading branch information
stepchowfun committed Aug 25, 2023
1 parent 10da872 commit 6241888
Show file tree
Hide file tree
Showing 17 changed files with 247 additions and 147 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ jobs:
set -euo pipefail
# Install the appropriate version of Rust.
rustup toolchain install 1.65.0 # [ref:rust_1.65.0]
rustup default 1.65.0 # [ref:rust_1.65.0]
rustup toolchain install 1.72.0 # [ref:rust_1.72.0]
rustup default 1.72.0 # [ref:rust_1.72.0]
# Add the targets.
rustup target add x86_64-pc-windows-msvc
Expand Down Expand Up @@ -120,8 +120,8 @@ jobs:
set -euo pipefail
# Install the appropriate version of Rust.
rustup toolchain install 1.65.0 # [ref:rust_1.65.0]
rustup default 1.65.0 # [ref:rust_1.65.0]
rustup toolchain install 1.72.0 # [ref:rust_1.72.0]
rustup default 1.72.0 # [ref:rust_1.72.0]
# Add the targets.
rustup target add x86_64-apple-darwin
Expand Down Expand Up @@ -193,8 +193,8 @@ jobs:
set -euo pipefail
# Install the appropriate version of Rust.
rustup toolchain install 1.65.0 # [ref:rust_1.65.0]
rustup default 1.65.0 # [ref:rust_1.65.0]
rustup toolchain install 1.72.0 # [ref:rust_1.72.0]
rustup default 1.72.0 # [ref:rust_1.72.0]
# Fetch the program version.
VERSION="$(cargo pkgid | cut -d# -f2 | cut -d: -f2)"
Expand Down
199 changes: 151 additions & 48 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions benchmarks/rust/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn benchmark<T: Serialize, U: Deserialize>(message: &T, iterations: usize) -> io
let mut buffer = Vec::<u8>::new();
buffer.reserve(message_size);

println!("Message size: {}", message_size);
println!("Message size: {message_size}");

let serialization_instant = Instant::now();

Expand All @@ -87,7 +87,7 @@ fn benchmark<T: Serialize, U: Deserialize>(message: &T, iterations: usize) -> io
let serialization_duration = serialization_instant.elapsed();

println!("Wrote {} bytes.", buffer.len());
println!("Serialization duration: {:?}", serialization_duration);
println!("Serialization duration: {serialization_duration:?}");
println!(
"Serialization rate: {} bytes/second",
(buffer.len() as f64) / serialization_duration.as_secs_f64()
Expand All @@ -102,7 +102,7 @@ fn benchmark<T: Serialize, U: Deserialize>(message: &T, iterations: usize) -> io

let deserialization_duration = deserialization_instant.elapsed();

println!("Deserialization duration: {:?}", deserialization_duration);
println!("Deserialization duration: {deserialization_duration:?}");
println!(
"Deserialization rate: {} bytes/second",
(buffer.len() as f64) / deserialization_duration.as_secs_f64()
Expand Down
10 changes: 5 additions & 5 deletions integration_tests/rust/src/assertions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ pub fn assert_match<T: Debug + Serialize, U: Debug + Deserialize>(
actual: &T,
expected: &U,
) -> io::Result<()> {
println!("Message to be serialized: {:?}", actual);
println!("Message to be serialized: {actual:?}");

let size = actual.size();
println!("Expected size of the serialized value: {:?}", size);
println!("Expected size of the serialized value: {size:?}");

let mut buffer = Vec::<u8>::new();
actual.serialize(&mut buffer)?;
println!("Bytes from serialization: {:?}", buffer);
println!("Bytes from serialization: {buffer:?}");
println!("Size of the serialized value: {:?}", buffer.len());
if buffer.len() != size {
return Err(Error::new(ErrorKind::Other, "Mismatch!"));
Expand All @@ -39,9 +39,9 @@ pub fn assert_match<T: Debug + Serialize, U: Debug + Deserialize>(
file.write_all(&buffer).unwrap();

let replica = U::deserialize(buffer.as_slice())?;
println!("Message deserialized from those bytes: {:?}", replica);
println!("Message deserialized from those bytes: {replica:?}");

if format!("{:?}", replica) != format!("{:?}", expected) {
if format!("{replica:?}") != format!("{expected:?}") {
return Err(Error::new(ErrorKind::Other, "Mismatch!"));
}

Expand Down
1 change: 1 addition & 0 deletions integration_tests/rust/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
clippy::let_unit_value,
clippy::match_same_arms,
clippy::match_single_binding,
clippy::misnamed_getters,
clippy::module_inception,
clippy::module_name_repetitions,
clippy::needless_borrow,
Expand Down
Loading

0 comments on commit 6241888

Please sign in to comment.