1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-08-07 17:03:01 +03:00

Fix clippy warning

This commit is contained in:
Quentin Gliech
2022-11-03 11:31:03 +01:00
parent 7db0a2abdf
commit 00909133d6

View File

@@ -96,7 +96,7 @@ impl<'a> TryFrom<&'a str> for RawJwt<'a> {
fn try_from(value: &'a str) -> Result<Self, Self::Error> { fn try_from(value: &'a str) -> Result<Self, Self::Error> {
let mut indices = value let mut indices = value
.char_indices() .char_indices()
.filter_map(|(idx, c)| (c == '.').then(|| idx)); .filter_map(|(idx, c)| (c == '.').then_some(idx));
let first_dot = indices.next().ok_or(DecodeError::NoDots)?; let first_dot = indices.next().ok_or(DecodeError::NoDots)?;
let second_dot = indices.next().ok_or(DecodeError::OnlyOneDot)?; let second_dot = indices.next().ok_or(DecodeError::OnlyOneDot)?;
@@ -118,7 +118,7 @@ impl TryFrom<String> for RawJwt<'static> {
fn try_from(value: String) -> Result<Self, Self::Error> { fn try_from(value: String) -> Result<Self, Self::Error> {
let mut indices = value let mut indices = value
.char_indices() .char_indices()
.filter_map(|(idx, c)| (c == '.').then(|| idx)); .filter_map(|(idx, c)| (c == '.').then_some(idx));
let first_dot = indices.next().ok_or(DecodeError::NoDots)?; let first_dot = indices.next().ok_or(DecodeError::NoDots)?;
let second_dot = indices.next().ok_or(DecodeError::OnlyOneDot)?; let second_dot = indices.next().ok_or(DecodeError::OnlyOneDot)?;