Skip to content

Commit 81ec8ee

Browse files
committed
chore: apply beta clippy fixes
1 parent 3c231f0 commit 81ec8ee

File tree

4 files changed

+18
-46
lines changed

4 files changed

+18
-46
lines changed

src/client.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ impl<T: Read + Write + Unpin + fmt::Debug + Send> Client<T> {
188188
let u = ok_or_unauth_client_err!(validate_str(username.as_ref()), self);
189189
let p = ok_or_unauth_client_err!(validate_str(password.as_ref()), self);
190190
ok_or_unauth_client_err!(
191-
self.run_command_and_check_ok(&format!("LOGIN {} {}", u, p), None)
191+
self.run_command_and_check_ok(&format!("LOGIN {u} {p}"), None)
192192
.await,
193193
self
194194
);
@@ -1454,17 +1454,10 @@ impl<T: Read + Write + Unpin + fmt::Debug> Connection<T> {
14541454
use imap_proto::Status;
14551455
match status {
14561456
Status::Ok => Ok(()),
1457-
Status::Bad => Err(Error::Bad(format!(
1458-
"code: {:?}, info: {:?}",
1459-
code, information
1460-
))),
1461-
Status::No => Err(Error::No(format!(
1462-
"code: {:?}, info: {:?}",
1463-
code, information
1464-
))),
1457+
Status::Bad => Err(Error::Bad(format!("code: {code:?}, info: {information:?}"))),
1458+
Status::No => Err(Error::No(format!("code: {code:?}, info: {information:?}"))),
14651459
_ => Err(Error::Io(io::Error::other(format!(
1466-
"status: {:?}, code: {:?}, information: {:?}",
1467-
status, code, information
1460+
"status: {status:?}, code: {code:?}, information: {information:?}"
14681461
)))),
14691462
}
14701463
}
@@ -2155,7 +2148,7 @@ mod tests {
21552148
K: 'a + Future<Output = Result<T>>,
21562149
{
21572150
let resp = res.as_bytes().to_vec();
2158-
let line = format!("A0001{}{} {} {}\r\n", prefix, cmd, seq, query);
2151+
let line = format!("A0001{prefix}{cmd} {seq} {query}\r\n");
21592152
let session = Arc::new(Mutex::new(mock_session!(MockStream::new(resp))));
21602153

21612154
{
@@ -2193,7 +2186,7 @@ mod tests {
21932186
return;
21942187
}
21952188
}
2196-
panic!("Wrong error: {:?}", e);
2189+
panic!("Wrong error: {e:?}");
21972190
}
21982191
panic!("No error");
21992192
}
@@ -2207,7 +2200,7 @@ mod tests {
22072200
return;
22082201
}
22092202
}
2210-
panic!("Wrong error: {:?}", e);
2203+
panic!("Wrong error: {e:?}");
22112204
}
22122205
panic!("No error");
22132206
}

src/imap_stream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl<R: Read + Write + Unpin> ImapStream<R> {
9191
Ok(response)
9292
}
9393
Err(nom::Err::Incomplete(Needed::Size(min))) => {
94-
log::trace!("decode: incomplete data, need minimum {} bytes", min);
94+
log::trace!("decode: incomplete data, need minimum {min} bytes");
9595
self.decode_needs = self.buffer.used() + usize::from(min);
9696
Err(None)
9797
}

src/mock_stream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl Read for MockStream {
103103
return Poll::Ready(Ok(0));
104104
}
105105
if self.err_on_read {
106-
return Poll::Ready(Err(Error::new(ErrorKind::Other, "MockStream Error")));
106+
return Poll::Ready(Err(Error::other("MockStream Error")));
107107
}
108108
if self.read_pos >= self.read_buf.len() {
109109
return Poll::Ready(Err(Error::new(ErrorKind::UnexpectedEof, "EOF")));

src/parse.rs

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -115,21 +115,14 @@ pub(crate) async fn parse_status<T: Stream<Item = io::Result<ResponseData>> + Un
115115
break;
116116
}
117117
Status::Bad => {
118-
return Err(Error::Bad(format!(
119-
"code: {:?}, info: {:?}",
120-
code, information
121-
)))
118+
return Err(Error::Bad(format!("code: {code:?}, info: {information:?}")))
122119
}
123120
Status::No => {
124-
return Err(Error::No(format!(
125-
"code: {:?}, info: {:?}",
126-
code, information
127-
)))
121+
return Err(Error::No(format!("code: {code:?}, info: {information:?}")))
128122
}
129123
_ => {
130124
return Err(Error::Io(io::Error::other(format!(
131-
"status: {:?}, code: {:?}, information: {:?}",
132-
status, code, information
125+
"status: {status:?}, code: {code:?}, information: {information:?}"
133126
))));
134127
}
135128
}
@@ -258,21 +251,14 @@ pub(crate) async fn parse_mailbox<T: Stream<Item = io::Result<ResponseData>> + U
258251
break;
259252
}
260253
Status::Bad => {
261-
return Err(Error::Bad(format!(
262-
"code: {:?}, info: {:?}",
263-
code, information
264-
)))
254+
return Err(Error::Bad(format!("code: {code:?}, info: {information:?}")))
265255
}
266256
Status::No => {
267-
return Err(Error::No(format!(
268-
"code: {:?}, info: {:?}",
269-
code, information
270-
)))
257+
return Err(Error::No(format!("code: {code:?}, info: {information:?}")))
271258
}
272259
_ => {
273260
return Err(Error::Io(io::Error::other(format!(
274-
"status: {:?}, code: {:?}, information: {:?}",
275-
status, code, information
261+
"status: {status:?}, code: {code:?}, information: {information:?}"
276262
))));
277263
}
278264
}
@@ -309,21 +295,14 @@ pub(crate) async fn parse_mailbox<T: Stream<Item = io::Result<ResponseData>> + U
309295
}
310296
}
311297
Status::Bad => {
312-
return Err(Error::Bad(format!(
313-
"code: {:?}, info: {:?}",
314-
code, information
315-
)))
298+
return Err(Error::Bad(format!("code: {code:?}, info: {information:?}")))
316299
}
317300
Status::No => {
318-
return Err(Error::No(format!(
319-
"code: {:?}, info: {:?}",
320-
code, information
321-
)))
301+
return Err(Error::No(format!("code: {code:?}, info: {information:?}")))
322302
}
323303
_ => {
324304
return Err(Error::Io(io::Error::other(format!(
325-
"status: {:?}, code: {:?}, information: {:?}",
326-
status, code, information
305+
"status: {status:?}, code: {code:?}, information: {information:?}"
327306
))));
328307
}
329308
}

0 commit comments

Comments
 (0)