Skip to content

Commit 57f8bb5

Browse files
authored
Update Rust to 1.85 and fix some future edition 2024 issues (#170)
## 🎟️ Tracking ## 📔 Objective Update pinned Rust version to 1.85, including a clippy lint fix for explicit operator precedence in `totp.rs`. Edition 2024 has reserved the keyword `gen`, so I've updated the few places where we use it in preparation for that future migration. Note that the new major version of `rand` has already renamed the `gen` method to `random` so that change is only temporary. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes
1 parent 6008e90 commit 57f8bb5

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

crates/bitwarden-crypto/src/enc_string/asymmetric.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ impl schemars::JsonSchema for AsymmetricEncString {
204204
"AsymmetricEncString".to_string()
205205
}
206206

207-
fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
208-
gen.subschema_for::<String>()
207+
fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
208+
generator.subschema_for::<String>()
209209
}
210210
}
211211

crates/bitwarden-crypto/src/enc_string/symmetric.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,8 @@ impl schemars::JsonSchema for EncString {
261261
"EncString".to_string()
262262
}
263263

264-
fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
265-
gen.subschema_for::<String>()
264+
fn json_schema(generator: &mut schemars::r#gen::SchemaGenerator) -> schemars::schema::Schema {
265+
generator.subschema_for::<String>()
266266
}
267267
}
268268

crates/bitwarden-crypto/src/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ where
3636
Standard: Distribution<T>,
3737
T: Zeroize,
3838
{
39-
Zeroizing::new(rand::thread_rng().gen::<T>())
39+
Zeroizing::new(rand::thread_rng().r#gen::<T>())
4040
}
4141

4242
/// Generate a random alphanumeric string of a given length

crates/bitwarden-vault/src/totp.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,10 @@ fn derive_steam_otp(binary: u32, digits: u32) -> String {
339339
fn derive_binary(hash: Vec<u8>) -> u32 {
340340
let offset = (hash.last().unwrap_or(&0) & 15) as usize;
341341

342-
((hash[offset] & 127) as u32) << 24
343-
| (hash[offset + 1] as u32) << 16
344-
| (hash[offset + 2] as u32) << 8
345-
| hash[offset + 3] as u32
342+
(((hash[offset] & 127) as u32) << 24)
343+
| ((hash[offset + 1] as u32) << 16)
344+
| ((hash[offset + 2] as u32) << 8)
345+
| (hash[offset + 3] as u32)
346346
}
347347

348348
/// This code is migrated from our javascript implementation and is not technically a correct base32

crates/memory-testing/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
###############################################
22
# Build stage #
33
###############################################
4-
FROM rust:1.84 AS build
4+
FROM rust:1.85 AS build
55

66
WORKDIR /app
77

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[toolchain]
2-
channel = "1.84.0"
2+
channel = "1.85.0"
33
components = [ "rustfmt", "clippy" ]
44
profile = "minimal"
55

0 commit comments

Comments
 (0)