Skip to content

Commit 6b85743

Browse files
committed
Clippy
1 parent 5556e13 commit 6b85743

File tree

18 files changed

+223
-86
lines changed

18 files changed

+223
-86
lines changed

edge-captive/src/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ pub fn reply(
127127

128128
struct Buf<'a>(pub &'a mut [u8], pub usize);
129129

130-
impl<'a> Composer for Buf<'a> {}
130+
impl Composer for Buf<'_> {}
131131

132-
impl<'a> OctetsBuilder for Buf<'a> {
132+
impl OctetsBuilder for Buf<'_> {
133133
type AppendError = ShortBuf;
134134

135135
fn append_slice(&mut self, slice: &[u8]) -> Result<(), Self::AppendError> {
@@ -145,19 +145,19 @@ impl<'a> OctetsBuilder for Buf<'a> {
145145
}
146146
}
147147

148-
impl<'a> Truncate for Buf<'a> {
148+
impl Truncate for Buf<'_> {
149149
fn truncate(&mut self, len: usize) {
150150
self.1 = len;
151151
}
152152
}
153153

154-
impl<'a> AsMut<[u8]> for Buf<'a> {
154+
impl AsMut<[u8]> for Buf<'_> {
155155
fn as_mut(&mut self) -> &mut [u8] {
156156
&mut self.0[..self.1]
157157
}
158158
}
159159

160-
impl<'a> AsRef<[u8]> for Buf<'a> {
160+
impl AsRef<[u8]> for Buf<'_> {
161161
fn as_ref(&self) -> &[u8] {
162162
&self.0[..self.1]
163163
}

edge-dhcp/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ pub enum DhcpOption<'a> {
573573
Unrecognized(u8, &'a [u8]),
574574
}
575575

576-
impl<'a> DhcpOption<'a> {
576+
impl DhcpOption<'_> {
577577
pub const CODE_ROUTER: u8 = DhcpOption::Router(Ipv4Addrs::new(&[])).code();
578578
pub const CODE_DNS: u8 = DhcpOption::DomainNameServer(Ipv4Addrs::new(&[])).code();
579579
pub const CODE_SUBNET: u8 = DhcpOption::SubnetMask(Ipv4Addr::new(0, 0, 0, 0)).code();

edge-http/src/io.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ where
371371
}
372372
}
373373

374-
impl<'b, R> ErrorType for Body<'b, R>
374+
impl<R> ErrorType for Body<'_, R>
375375
where
376376
R: ErrorType,
377377
{
@@ -419,7 +419,7 @@ impl<'b, R> PartiallyRead<'b, R> {
419419
}
420420
}
421421

422-
impl<'b, R> ErrorType for PartiallyRead<'b, R>
422+
impl<R> ErrorType for PartiallyRead<'_, R>
423423
where
424424
R: ErrorType,
425425
{
@@ -698,7 +698,7 @@ where
698698
}
699699
}
700700

701-
impl<'b, R> ErrorType for ChunkedRead<'b, R>
701+
impl<R> ErrorType for ChunkedRead<'_, R>
702702
where
703703
R: ErrorType,
704704
{

edge-http/src/io/client.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ where
343343
}
344344
}
345345

346-
impl<'b, T, const N: usize> ErrorType for Connection<'b, T, N>
346+
impl<T, const N: usize> ErrorType for Connection<'_, T, N>
347347
where
348348
T: TcpConnect,
349349
{

edge-http/src/io/server.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ where
268268
}
269269
}
270270

271-
impl<'b, T, const N: usize> ErrorType for Connection<'b, T, N>
271+
impl<T, const N: usize> ErrorType for Connection<'_, T, N>
272272
where
273273
T: ErrorType,
274274
{

edge-http/src/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ impl<'b, const N: usize> Headers<'b, N> {
368368
}
369369
}
370370

371-
impl<'b, const N: usize> Default for Headers<'b, N> {
371+
impl<const N: usize> Default for Headers<'_, N> {
372372
fn default() -> Self {
373373
Self::new()
374374
}
@@ -421,7 +421,7 @@ pub struct RequestHeaders<'b, const N: usize> {
421421
pub headers: Headers<'b, N>,
422422
}
423423

424-
impl<'b, const N: usize> RequestHeaders<'b, N> {
424+
impl<const N: usize> RequestHeaders<'_, N> {
425425
#[inline(always)]
426426
pub const fn new() -> Self {
427427
Self {
@@ -437,7 +437,7 @@ impl<'b, const N: usize> RequestHeaders<'b, N> {
437437
}
438438
}
439439

440-
impl<'b, const N: usize> Display for RequestHeaders<'b, N> {
440+
impl<const N: usize> Display for RequestHeaders<'_, N> {
441441
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
442442
if let Some(http11) = self.http11 {
443443
write!(f, "{} ", if http11 { "HTTP/1.1" } else { "HTTP/1.0" })?;
@@ -467,7 +467,7 @@ pub struct ResponseHeaders<'b, const N: usize> {
467467
pub headers: Headers<'b, N>,
468468
}
469469

470-
impl<'b, const N: usize> ResponseHeaders<'b, N> {
470+
impl<const N: usize> ResponseHeaders<'_, N> {
471471
#[inline(always)]
472472
pub const fn new() -> Self {
473473
Self {
@@ -487,7 +487,7 @@ impl<'b, const N: usize> ResponseHeaders<'b, N> {
487487
}
488488
}
489489

490-
impl<'b, const N: usize> Display for ResponseHeaders<'b, N> {
490+
impl<const N: usize> Display for ResponseHeaders<'_, N> {
491491
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
492492
if let Some(http11) = self.http11 {
493493
writeln!(f, "{} ", if http11 { "HTTP/1.1 " } else { "HTTP/1.0" })?;

edge-mdns/src/buf.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ where
2828
B: BufferAccess<T>,
2929
T: ?Sized,
3030
{
31-
type Buffer<'a> = B::Buffer<'a> where Self: 'a;
31+
type Buffer<'a>
32+
= B::Buffer<'a>
33+
where
34+
Self: 'a;
3235

3336
async fn get(&self) -> Option<Self::Buffer<'_>> {
3437
(*self).get().await
@@ -52,7 +55,7 @@ pub struct VecBuf<'a, M, const N: usize>(MutexGuard<'a, M, heapless::Vec<u8, N>>
5255
where
5356
M: RawMutex;
5457

55-
impl<'a, M, const N: usize> Drop for VecBuf<'a, M, N>
58+
impl<M, const N: usize> Drop for VecBuf<'_, M, N>
5659
where
5760
M: RawMutex,
5861
{
@@ -61,7 +64,7 @@ where
6164
}
6265
}
6366

64-
impl<'a, M, const N: usize> Deref for VecBuf<'a, M, N>
67+
impl<M, const N: usize> Deref for VecBuf<'_, M, N>
6568
where
6669
M: RawMutex,
6770
{
@@ -72,7 +75,7 @@ where
7275
}
7376
}
7477

75-
impl<'a, M, const N: usize> DerefMut for VecBuf<'a, M, N>
78+
impl<M, const N: usize> DerefMut for VecBuf<'_, M, N>
7679
where
7780
M: RawMutex,
7881
{
@@ -85,7 +88,10 @@ impl<M, const N: usize> BufferAccess<[u8]> for VecBufAccess<M, N>
8588
where
8689
M: RawMutex,
8790
{
88-
type Buffer<'a> = VecBuf<'a, M, N> where Self: 'a;
91+
type Buffer<'a>
92+
= VecBuf<'a, M, N>
93+
where
94+
Self: 'a;
8995

9096
async fn get(&self) -> Option<Self::Buffer<'_>> {
9197
let mut guard = self.0.lock().await;

edge-mdns/src/host.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub struct Host<'a> {
2323
pub ttl: Ttl,
2424
}
2525

26-
impl<'a> Host<'a> {
26+
impl Host<'_> {
2727
fn visit_answers<F, E>(&self, mut f: F) -> Result<(), E>
2828
where
2929
F: FnMut(HostAnswer) -> Result<(), E>,
@@ -57,7 +57,7 @@ impl<'a> Host<'a> {
5757
}
5858
}
5959

60-
impl<'a> HostAnswers for Host<'a> {
60+
impl HostAnswers for Host<'_> {
6161
fn visit<F, E>(&self, mut f: F) -> Result<(), E>
6262
where
6363
F: FnMut(HostAnswer) -> Result<(), E>,
@@ -92,7 +92,7 @@ pub struct Service<'a> {
9292
pub txt_kvs: &'a [(&'a str, &'a str)],
9393
}
9494

95-
impl<'a> Service<'a> {
95+
impl Service<'_> {
9696
fn visit_answers<F, E>(&self, host: &Host, mut f: F) -> Result<(), E>
9797
where
9898
F: FnMut(HostAnswer) -> Result<(), E>,
@@ -181,7 +181,7 @@ impl<'a> ServiceAnswers<'a> {
181181
}
182182
}
183183

184-
impl<'a> HostAnswers for ServiceAnswers<'a> {
184+
impl HostAnswers for ServiceAnswers<'_> {
185185
fn visit<F, E>(&self, mut f: F) -> Result<(), E>
186186
where
187187
F: FnMut(HostAnswer) -> Result<(), E>,

edge-mdns/src/lib.rs

+23-17
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ impl<'a> NameSlice<'a> {
9999
}
100100
}
101101

102-
impl<'a> fmt::Display for NameSlice<'a> {
102+
impl fmt::Display for NameSlice<'_> {
103103
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
104104
for label in self.0 {
105105
write!(f, "{}.", label)?;
@@ -109,7 +109,7 @@ impl<'a> fmt::Display for NameSlice<'a> {
109109
}
110110
}
111111

112-
impl<'a> ToName for NameSlice<'a> {}
112+
impl ToName for NameSlice<'_> {}
113113

114114
/// An iterator over the labels in a `NameSlice` instance.
115115
#[derive(Clone)]
@@ -138,7 +138,7 @@ impl<'a> Iterator for NameSliceIter<'a> {
138138
}
139139
}
140140

141-
impl<'a> DoubleEndedIterator for NameSliceIter<'a> {
141+
impl DoubleEndedIterator for NameSliceIter<'_> {
142142
fn next_back(&mut self) -> Option<Self::Item> {
143143
if self.index > 0 {
144144
self.index -= 1;
@@ -155,8 +155,11 @@ impl<'a> DoubleEndedIterator for NameSliceIter<'a> {
155155
}
156156
}
157157

158-
impl<'a> ToLabelIter for NameSlice<'a> {
159-
type LabelIter<'t> = NameSliceIter<'t> where Self: 't;
158+
impl ToLabelIter for NameSlice<'_> {
159+
type LabelIter<'t>
160+
= NameSliceIter<'t>
161+
where
162+
Self: 't;
160163

161164
fn iter_labels(&self) -> Self::LabelIter<'_> {
162165
NameSliceIter {
@@ -177,7 +180,7 @@ impl<'a> Txt<'a> {
177180
}
178181
}
179182

180-
impl<'a> fmt::Display for Txt<'a> {
183+
impl fmt::Display for Txt<'_> {
181184
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
182185
write!(f, "Txt [")?;
183186

@@ -195,13 +198,13 @@ impl<'a> fmt::Display for Txt<'a> {
195198
}
196199
}
197200

198-
impl<'a> RecordData for Txt<'a> {
201+
impl RecordData for Txt<'_> {
199202
fn rtype(&self) -> Rtype {
200203
Rtype::TXT
201204
}
202205
}
203206

204-
impl<'a> ComposeRecordData for Txt<'a> {
207+
impl ComposeRecordData for Txt<'_> {
205208
fn rdlen(&self, _compress: bool) -> Option<u16> {
206209
None
207210
}
@@ -217,7 +220,7 @@ impl<'a> ComposeRecordData for Txt<'a> {
217220
for (k, v) in self.0 {
218221
target.append_slice(&[(k.len() + v.len() + 1) as u8])?;
219222
target.append_slice(k.as_bytes())?;
220-
target.append_slice(&[b'='])?;
223+
target.append_slice(b"=")?;
221224
target.append_slice(v.as_bytes())?;
222225
}
223226
}
@@ -313,16 +316,19 @@ impl<'a> Buf<'a> {
313316
}
314317
}
315318

316-
impl<'a> FreezeBuilder for Buf<'a> {
319+
impl FreezeBuilder for Buf<'_> {
317320
type Octets = Self;
318321

319322
fn freeze(self) -> Self {
320323
self
321324
}
322325
}
323326

324-
impl<'a> Octets for Buf<'a> {
325-
type Range<'r> = &'r [u8] where Self: 'r;
327+
impl Octets for Buf<'_> {
328+
type Range<'r>
329+
= &'r [u8]
330+
where
331+
Self: 'r;
326332

327333
fn range(&self, range: impl RangeBounds<usize>) -> Self::Range<'_> {
328334
self.0[..self.1].range(range)
@@ -337,9 +343,9 @@ impl<'a> FromBuilder for Buf<'a> {
337343
}
338344
}
339345

340-
impl<'a> Composer for Buf<'a> {}
346+
impl Composer for Buf<'_> {}
341347

342-
impl<'a> OctetsBuilder for Buf<'a> {
348+
impl OctetsBuilder for Buf<'_> {
343349
type AppendError = ShortBuf;
344350

345351
fn append_slice(&mut self, slice: &[u8]) -> Result<(), Self::AppendError> {
@@ -355,19 +361,19 @@ impl<'a> OctetsBuilder for Buf<'a> {
355361
}
356362
}
357363

358-
impl<'a> Truncate for Buf<'a> {
364+
impl Truncate for Buf<'_> {
359365
fn truncate(&mut self, len: usize) {
360366
self.1 = len;
361367
}
362368
}
363369

364-
impl<'a> AsMut<[u8]> for Buf<'a> {
370+
impl AsMut<[u8]> for Buf<'_> {
365371
fn as_mut(&mut self) -> &mut [u8] {
366372
&mut self.0[..self.1]
367373
}
368374
}
369375

370-
impl<'a> AsRef<[u8]> for Buf<'a> {
376+
impl AsRef<[u8]> for Buf<'_> {
371377
fn as_ref(&self) -> &[u8] {
372378
&self.0[..self.1]
373379
}

edge-mqtt/src/io.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ mod embedded_svc_compat {
121121
}
122122

123123
impl Connection for MqttConnection {
124-
type Event<'a> = MqttEvent where Self: 'a;
124+
type Event<'a>
125+
= MqttEvent
126+
where
127+
Self: 'a;
125128

126129
#[allow(clippy::large_futures)]
127130
async fn next(&mut self) -> Result<Self::Event<'_>, Self::Error> {

0 commit comments

Comments
 (0)