aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-01-03 16:00:19 +0100
committerAlex Auvolat <alex@adnab.me>2023-01-03 16:00:19 +0100
commitc106304b9cd325238742be4366877ed7316e7e28 (patch)
tree1317779737aced72ce84ffae6297b2dbaf5e841c
parent33f25d26c7a81f7dc7ae3ab4fd2faa49fb053ceb (diff)
downloadgarage-c106304b9cd325238742be4366877ed7316e7e28.tar.gz
garage-c106304b9cd325238742be4366877ed7316e7e28.zip
more idiomatic and shorter
-rw-r--r--src/util/migrate.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util/migrate.rs b/src/util/migrate.rs
index b7d6edc1..00d81181 100644
--- a/src/util/migrate.rs
+++ b/src/util/migrate.rs
@@ -18,7 +18,7 @@ pub trait Migrate: Serialize + for<'de> Deserialize<'de> + 'static {
/// Decode an encoded version of this type, going through a migration if necessary.
fn decode(bytes: &[u8]) -> Option<Self> {
let marker_len = Self::VERSION_MARKER.len();
- if bytes.len() >= marker_len && &bytes[..marker_len] == Self::VERSION_MARKER {
+ if bytes.get(..marker_len) == Some(Self::VERSION_MARKER) {
if let Ok(value) = rmp_serde::decode::from_read_ref::<_, Self>(&bytes[marker_len..]) {
return Some(value);
}