Skip to content

Commit

Permalink
Use const len now that MSRV is > 1.39
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys committed Jul 27, 2024
1 parent 32518fa commit 9c7e2d3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,12 @@ impl std::error::Error for MessageError {
}
}

// Use str::len as a const fn once we bump MSRV over 1.39.
const RUNNER_MAGIC_NUMBER: &str = "cargo-criterion";
const RUNNER_HELLO_SIZE: usize = 15 //RUNNER_MAGIC_NUMBER.len() // magic number
const RUNNER_HELLO_SIZE: usize = RUNNER_MAGIC_NUMBER.len() // magic number
+ (size_of::<u8>() * 3); // version number

const BENCHMARK_MAGIC_NUMBER: &str = "Criterion";
const BENCHMARK_HELLO_SIZE: usize = 9 //BENCHMARK_MAGIC_NUMBER.len() // magic number
const BENCHMARK_HELLO_SIZE: usize = BENCHMARK_MAGIC_NUMBER.len() // magic number
+ (size_of::<u8>() * 3) // version number
+ size_of::<u16>() // protocol version
+ size_of::<u16>(); // protocol format
Expand Down

0 comments on commit 9c7e2d3

Please sign in to comment.