Skip to content

Commit

Permalink
Merge 49a1208 into eac3a6a
Browse files Browse the repository at this point in the history
  • Loading branch information
duesee committed Apr 6, 2024
2 parents eac3a6a + 49a1208 commit e0e5554
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ jobs:
uses: actions-rs/clippy-check@b5b5f21f4797c02da247df37026fcd0a5024aa4d
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
args: --workspace --all-features --all-targets

formatting:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion imap-codec/src/codec/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub(crate) enum IMAPErrorKind<'a> {
BadDateTime,
LiteralContainsNull,
RecursionLimitExceeded,
Nom(ErrorKind),
Nom(#[allow(dead_code)] ErrorKind),
}

impl<'a, I> ParseError<I> for IMAPParseError<'a, I> {
Expand Down
3 changes: 3 additions & 0 deletions imap-codec/src/extensions/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use crate::{
/// ```
///
/// Note: Updated ABNF.
#[allow(clippy::type_complexity)]
pub(crate) fn id(input: &[u8]) -> IMAPResult<&[u8], Option<Vec<(IString, NString)>>> {
preceded(tag_no_case("ID "), id_params_list)(input)
}
Expand All @@ -35,6 +36,7 @@ pub(crate) fn id(input: &[u8]) -> IMAPResult<&[u8], Option<Vec<(IString, NString
///
/// Note: Updated ABNF.
#[inline]
#[allow(clippy::type_complexity)]
pub(crate) fn id_response(input: &[u8]) -> IMAPResult<&[u8], Option<Vec<(IString, NString)>>> {
id(input)
}
Expand All @@ -44,6 +46,7 @@ pub(crate) fn id_response(input: &[u8]) -> IMAPResult<&[u8], Option<Vec<(IString
/// ```
///
/// Note: Updated ABNF. (See https://github.com/modern-email/defects/issues/12)
#[allow(clippy::type_complexity)]
pub(crate) fn id_params_list(input: &[u8]) -> IMAPResult<&[u8], Option<Vec<(IString, NString)>>> {
alt((
map(
Expand Down
4 changes: 2 additions & 2 deletions imap-codec/src/extensions/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::{
search::search_criteria,
};

impl<'a> EncodeIntoContext for Thread {
impl EncodeIntoContext for Thread {
fn encode_ctx(&self, ctx: &mut EncodeContext) -> std::io::Result<()> {
ctx.write_all(self.to_string().as_bytes())
}
Expand Down Expand Up @@ -319,7 +319,7 @@ mod tests {
),
];

for (test, expected) in tests.into_iter() {
for (test, expected) in tests {
println!("test: {}", test);
println!("expected: {}\n", expected);
assert_eq!(*test, expected.to_string().as_str());
Expand Down
2 changes: 1 addition & 1 deletion imap-codec/src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ mod tests {
(SearchKey::Text(AString::try_from("A").unwrap()), b"TEXT A"),
(SearchKey::To(AString::try_from("A").unwrap()), b"TO A"),
(
SearchKey::Uid(SequenceSet::try_from(Sequence::try_from(1..).unwrap()).unwrap()),
SearchKey::Uid(SequenceSet::from(Sequence::try_from(1..).unwrap())),
b"UID 1:*",
),
(SearchKey::Unanswered, b"UNANSWERED"),
Expand Down
46 changes: 21 additions & 25 deletions imap-types/src/extensions/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,34 +48,30 @@ impl Display for Thread {
}
};

loop {
if let Some(answers) = stack.last_mut() {
if let Some(thread) = answers.next() {
let thing = match thread {
Self::Members { prefix, answers } => {
write!(f, "(")?;
write_prefix(f, prefix)?;
match answers {
Some(answers) => {
write!(f, " ")?;
answers.as_ref().iter()
}
None => empty_answers.iter(),
while let Some(answers) = stack.last_mut() {
if let Some(thread) = answers.next() {
let thing = match thread {
Self::Members { prefix, answers } => {
write!(f, "(")?;
write_prefix(f, prefix)?;
match answers {
Some(answers) => {
write!(f, " ")?;
answers.as_ref().iter()
}
None => empty_answers.iter(),
}
Self::Nested { answers } => {
write!(f, "(")?;
answers.as_ref().iter()
}
};
}
Self::Nested { answers } => {
write!(f, "(")?;
answers.as_ref().iter()
}
};

stack.push(thing);
} else {
stack.pop();
write!(f, ")")?;
}
stack.push(thing);
} else {
break;
stack.pop();
write!(f, ")")?;
}
}

Expand Down Expand Up @@ -137,7 +133,7 @@ fn arbitrary_thread_limited<'a>(
}

#[cfg(feature = "arbitrary")]
fn arbitrary_thread_leaf<'a>(u: &mut Unstructured<'a>) -> arbitrary::Result<Thread> {
fn arbitrary_thread_leaf(u: &mut Unstructured) -> arbitrary::Result<Thread> {
Ok(Thread::Members {
prefix: Arbitrary::arbitrary(u)?,
answers: None,
Expand Down

0 comments on commit e0e5554

Please sign in to comment.