-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Update rand
crate 0.8.5 -> 0.9.0
#1255
Conversation
|
Assume I need to update Cargo.lock.msrv 🤔 I'll get on that shortly! |
Update procedure is documented here: https://github.com/scylladb/scylla-rust-driver/blob/main/CONTRIBUTING.md#min_rust-workflow-and-cargolockmsrv |
Clippy failed, but that's most likely not related to your changes, but to the recent release of Rust 1.85 - we will have to fix that.
One other minor comment: in this case I'd prefer all the changes in the single commit. There are not many of them, so it won't make the commit difficult to read, but it will prevent having commits with deprecation warnings. |
And here I went through all the trouble splitting my original commit 😁 I'll sort that as well |
@Lorak-mmk : I'd probably "fix" the clippy lints like this impl CqlTimeuuid {
/// Read 8 most significant bytes of timeuuid from serialized bytes
fn msb(&self) -> u64 {
// Scylla and Cassandra use a standard UUID memory layout for MSB:
// 4 bytes 2 bytes 2 bytes
// time_low - time_mid - time_hi_and_version
let bytes = self.0.as_bytes();
u64::from_be_bytes([
bytes[6] & 0x0F, bytes[7], bytes[4], bytes[5], bytes[0], bytes[1], bytes[2], bytes[3],
])
}
fn lsb(&self) -> u64 {
let bytes = self.0.as_bytes();
u64::from_be_bytes([
bytes[8], bytes[9], bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15],
])
}
fn lsb_signed(&self) -> u64 {
self.lsb() ^ 0x8080808080808080
}
} Gets rid of most of the exposed bit twiddling. As far as I've been able to tell where I've done the same elsewhere, the generated code isn't really any worse. This passes, btw #[test]
fn asdf() {
let bytes = [1, 2, 3, 4, 5, 6, 7, 8];
let a = u64::from_be_bytes([
bytes[6] & 0x0F, bytes[7], bytes[4], bytes[5], bytes[0], bytes[1], bytes[2], bytes[3],
]);
let b = ((bytes[6] & 0x0F) as u64) << 56
| (bytes[7] as u64) << 48
| (bytes[4] as u64) << 40
| (bytes[5] as u64) << 32
| (bytes[0] as u64) << 24
| (bytes[1] as u64) << 16
| (bytes[2] as u64) << 8
| (bytes[3] as u64);
assert_eq!(a, b);
} |
Strike that -- the generated code (at least on x86) seems to be significantly better. I think I'll start aggressively change things myself, where it makes sense (in my code bases ofc :) ) |
#1256 should hopefully fix the clippy lints |
I've merged it. Please rebase this PR on main. |
Also updates the following to align versions and avoid duplicates in transitive dependencies * `rand_pcg` 0.3.1 -> 0.9.0 * `rand_chacha` 0.3.1 -> 0.9.0
Thanks! |
Also updates the following to align versions and avoid duplicates in transitive dependencies
rand_pcg
0.3.1 -> 0.9.0rand_chacha
0.3.1 -> 0.9.0MSRV for all changes is 1.63, so should hopefully be good
I'm currently trying to reduce the number of duplicate dependencies to reduce some bloat in my projects, and
rand
is one of them.Pre-review checklist
./docs/source/
.Fixes:
annotations to PR description.