Skip to content

Commit b471a90

Browse files
authored
Merge pull request #357 from danieleades/clippy-msrv
configure the clippy MSRV
2 parents 59efe94 + 022d10c commit b471a90

File tree

7 files changed

+15
-29
lines changed

7 files changed

+15
-29
lines changed

.clippy.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
msrv = "1.65.0"

capnp/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,21 +234,21 @@ impl core::convert::From<::std::io::Error> for Error {
234234
_ => ErrorKind::Failed,
235235
};
236236
Self {
237-
description: format!("{}", err),
237+
description: format!("{err}"),
238238
kind,
239239
}
240240
}
241241
}
242242

243243
impl core::convert::From<alloc::string::FromUtf8Error> for Error {
244244
fn from(err: alloc::string::FromUtf8Error) -> Self {
245-
Self::failed(format!("{}", err))
245+
Self::failed(format!("{err}"))
246246
}
247247
}
248248

249249
impl core::convert::From<alloc::str::Utf8Error> for Error {
250250
fn from(err: alloc::str::Utf8Error) -> Self {
251-
Self::failed(format!("{}", err))
251+
Self::failed(format!("{err}"))
252252
}
253253
}
254254

capnp/src/private/arena.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ where
103103

104104
Ok((seg.as_ptr(), (seg.len() / BYTES_PER_WORD) as u32))
105105
}
106-
None => Err(Error::failed(format!("Invalid segment id: {}", id))),
106+
None => Err(Error::failed(format!("Invalid segment id: {id}"))),
107107
}
108108
}
109109

capnp/src/private/layout.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl ElementSize {
6464
5 => Self::EightBytes,
6565
6 => Self::Pointer,
6666
7 => Self::InlineComposite,
67-
_ => panic!("illegal element size: {}", val),
67+
_ => panic!("illegal element size: {val}"),
6868
}
6969
}
7070
}
@@ -124,7 +124,7 @@ impl WirePointerKind {
124124
1 => Self::List,
125125
2 => Self::Far,
126126
3 => Self::Other,
127-
_ => panic!("illegal element size: {}", val),
127+
_ => panic!("illegal element size: {val}"),
128128
}
129129
}
130130
}
@@ -2427,8 +2427,7 @@ mod wire_helpers {
24272427
match cap_table.extract_cap(n) {
24282428
Some(client_hook) => Ok(client_hook),
24292429
None => Err(Error::failed(format!(
2430-
"Message contains invalid capability pointer. Index: {}",
2431-
n
2430+
"Message contains invalid capability pointer. Index: {n}"
24322431
))),
24332432
}
24342433
}

capnp/src/serialize.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -339,15 +339,9 @@ where
339339
let segment_count = u32::from_le_bytes(buf[0..4].try_into().unwrap()).wrapping_add(1) as usize;
340340

341341
if segment_count >= SEGMENTS_COUNT_LIMIT {
342-
return Err(Error::failed(format!(
343-
"Too many segments: {}",
344-
segment_count
345-
)));
342+
return Err(Error::failed(format!("Too many segments: {segment_count}")));
346343
} else if segment_count == 0 {
347-
return Err(Error::failed(format!(
348-
"Too few segments: {}",
349-
segment_count
350-
)));
344+
return Err(Error::failed(format!("Too few segments: {segment_count}")));
351345
}
352346

353347
let mut segment_lengths_builder = SegmentLengthsBuilder::with_capacity(segment_count);

capnp/src/serialize/no_alloc_slice_segments.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ impl<'b> NoAllocSliceSegments<'b> {
4747

4848
if segments_count >= SEGMENTS_COUNT_LIMIT {
4949
return Err(Error::failed(format!(
50-
"Too many segments: {}",
51-
segments_count
50+
"Too many segments: {segments_count}"
5251
)));
5352
}
5453

@@ -75,9 +74,8 @@ impl<'b> NoAllocSliceSegments<'b> {
7574
let total_segments_length_words = total_segments_length_bytes / 8;
7675
if total_segments_length_words > limit {
7776
return Err(Error::failed(format!(
78-
"Message has {} words, which is too large. To increase the limit on the \
79-
receiving end, see capnp::message::ReaderOptions.",
80-
total_segments_length_words
77+
"Message has {total_segments_length_words} words, which is too large. To increase the limit on the \
78+
receiving end, see capnp::message::ReaderOptions."
8179
)));
8280
}
8381
}

capnp/src/text.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ pub type Reader<'a> = &'a str;
3838
pub fn new_reader(v: &[u8]) -> Result<Reader<'_>> {
3939
match str::from_utf8(v) {
4040
Ok(v) => Ok(v),
41-
Err(e) => Err(Error::failed(format!(
42-
"Text contains non-utf8 data: {:?}",
43-
e
44-
))),
41+
Err(e) => Err(Error::failed(format!("Text contains non-utf8 data: {e:?}"))),
4542
}
4643
}
4744

@@ -63,10 +60,7 @@ impl<'a> Builder<'a> {
6360
pub fn new(bytes: &mut [u8], pos: u32) -> Result<Builder<'_>> {
6461
if pos != 0 {
6562
if let Err(e) = str::from_utf8(bytes) {
66-
return Err(Error::failed(format!(
67-
"Text contains non-utf8 data: {:?}",
68-
e
69-
)));
63+
return Err(Error::failed(format!("Text contains non-utf8 data: {e:?}")));
7064
}
7165
}
7266
Ok(Builder {

0 commit comments

Comments
 (0)