mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-09-11 19:13:02 +02:00
apply new rustfmt.toml changes, fix some clippy lints
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
0317cc8cc5
commit
77e0b76408
296 changed files with 7147 additions and 4300 deletions
|
@ -29,10 +29,10 @@ impl RawId {
|
|||
#[must_use]
|
||||
pub fn shortroomid(self) -> [u8; INT_LEN] {
|
||||
match self {
|
||||
Self::Normal(raw) => raw[0..INT_LEN]
|
||||
| Self::Normal(raw) => raw[0..INT_LEN]
|
||||
.try_into()
|
||||
.expect("normal raw shortroomid array from slice"),
|
||||
Self::Backfilled(raw) => raw[0..INT_LEN]
|
||||
| Self::Backfilled(raw) => raw[0..INT_LEN]
|
||||
.try_into()
|
||||
.expect("backfilled raw shortroomid array from slice"),
|
||||
}
|
||||
|
@ -42,10 +42,10 @@ impl RawId {
|
|||
#[must_use]
|
||||
pub fn shorteventid(self) -> [u8; INT_LEN] {
|
||||
match self {
|
||||
Self::Normal(raw) => raw[INT_LEN..INT_LEN * 2]
|
||||
| Self::Normal(raw) => raw[INT_LEN..INT_LEN * 2]
|
||||
.try_into()
|
||||
.expect("normal raw shorteventid array from slice"),
|
||||
Self::Backfilled(raw) => raw[INT_LEN * 2..INT_LEN * 3]
|
||||
| Self::Backfilled(raw) => raw[INT_LEN * 2..INT_LEN * 3]
|
||||
.try_into()
|
||||
.expect("backfilled raw shorteventid array from slice"),
|
||||
}
|
||||
|
@ -55,8 +55,8 @@ impl RawId {
|
|||
#[must_use]
|
||||
pub fn as_bytes(&self) -> &[u8] {
|
||||
match self {
|
||||
Self::Normal(ref raw) => raw,
|
||||
Self::Backfilled(ref raw) => raw,
|
||||
| Self::Normal(ref raw) => raw,
|
||||
| Self::Backfilled(ref raw) => raw,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,17 +70,17 @@ impl From<&[u8]> for RawId {
|
|||
#[inline]
|
||||
fn from(id: &[u8]) -> Self {
|
||||
match id.len() {
|
||||
Self::NORMAL_LEN => Self::Normal(
|
||||
| Self::NORMAL_LEN => Self::Normal(
|
||||
id[0..Self::NORMAL_LEN]
|
||||
.try_into()
|
||||
.expect("normal RawId from [u8]"),
|
||||
),
|
||||
Self::BACKFILLED_LEN => Self::Backfilled(
|
||||
| Self::BACKFILLED_LEN => Self::Backfilled(
|
||||
id[0..Self::BACKFILLED_LEN]
|
||||
.try_into()
|
||||
.expect("backfilled RawId from [u8]"),
|
||||
),
|
||||
_ => unimplemented!("unrecognized RawId length"),
|
||||
| _ => unimplemented!("unrecognized RawId length"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,11 +95,11 @@ impl From<Id> for RawId {
|
|||
vec.extend(id.shortroomid.to_be_bytes());
|
||||
id.shorteventid.debug_assert_valid();
|
||||
match id.shorteventid {
|
||||
Count::Normal(shorteventid) => {
|
||||
| Count::Normal(shorteventid) => {
|
||||
vec.extend(shorteventid.to_be_bytes());
|
||||
Self::Normal(vec.as_ref().try_into().expect("RawVec into RawId::Normal"))
|
||||
},
|
||||
Count::Backfilled(shorteventid) => {
|
||||
| Count::Backfilled(shorteventid) => {
|
||||
vec.extend(0_u64.to_be_bytes());
|
||||
vec.extend(shorteventid.to_be_bytes());
|
||||
Self::Backfilled(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue