Skip to content

Commit c1053c3

Browse files
committed
fix clippy warnings
1 parent 4bdd2c4 commit c1053c3

File tree

6 files changed

+67
-74
lines changed

6 files changed

+67
-74
lines changed

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ const fn is_utf16_low_surrogate(u: u16) -> bool {
597597
/// Convert a UTF-16 surrogate pair to a `char`. Does not validate if the surrogates are valid.
598598
#[inline(always)]
599599
unsafe fn decode_utf16_surrogate_pair(high: u16, low: u16) -> char {
600-
let c: u32 = (((high - 0xD800) as u32) << 10 | ((low) - 0xDC00) as u32) + 0x1_0000;
600+
let c: u32 = ((((high - 0xD800) as u32) << 10) | ((low) - 0xDC00) as u32) + 0x1_0000;
601601
// SAFETY: we checked that it's a legal unicode value
602602
core::char::from_u32_unchecked(c)
603603
}

src/platform/windows.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![cfg(windows)]
21
use std::ffi::{OsStr, OsString};
32
use std::os::windows::ffi::{OsStrExt, OsStringExt};
43

src/ucstr.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1990,21 +1990,21 @@ pub struct Display<'a, S: ?Sized> {
19901990
str: &'a S,
19911991
}
19921992

1993-
impl<'a> core::fmt::Debug for Display<'a, U16CStr> {
1993+
impl core::fmt::Debug for Display<'_, U16CStr> {
19941994
#[inline]
19951995
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
19961996
core::fmt::Debug::fmt(&self.str, f)
19971997
}
19981998
}
19991999

2000-
impl<'a> core::fmt::Debug for Display<'a, U32CStr> {
2000+
impl core::fmt::Debug for Display<'_, U32CStr> {
20012001
#[inline]
20022002
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
20032003
core::fmt::Debug::fmt(&self.str, f)
20042004
}
20052005
}
20062006

2007-
impl<'a> core::fmt::Display for Display<'a, U16CStr> {
2007+
impl core::fmt::Display for Display<'_, U16CStr> {
20082008
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
20092009
for c in crate::decode_utf16_lossy(self.str.as_slice().iter().copied()) {
20102010
// Allow alternate {:#} format which skips replacment chars entirely
@@ -2016,7 +2016,7 @@ impl<'a> core::fmt::Display for Display<'a, U16CStr> {
20162016
}
20172017
}
20182018

2019-
impl<'a> core::fmt::Display for Display<'a, U32CStr> {
2019+
impl core::fmt::Display for Display<'_, U32CStr> {
20202020
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
20212021
for c in crate::decode_utf32_lossy(self.str.as_slice().iter().copied()) {
20222022
// Allow alternate {:#} format which skips replacment chars entirely

src/ustr.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1317,21 +1317,21 @@ pub struct Display<'a, S: ?Sized> {
13171317
str: &'a S,
13181318
}
13191319

1320-
impl<'a> core::fmt::Debug for Display<'a, U16Str> {
1320+
impl core::fmt::Debug for Display<'_, U16Str> {
13211321
#[inline]
13221322
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
13231323
core::fmt::Debug::fmt(&self.str, f)
13241324
}
13251325
}
13261326

1327-
impl<'a> core::fmt::Debug for Display<'a, U32Str> {
1327+
impl core::fmt::Debug for Display<'_, U32Str> {
13281328
#[inline]
13291329
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
13301330
core::fmt::Debug::fmt(&self.str, f)
13311331
}
13321332
}
13331333

1334-
impl<'a> core::fmt::Display for Display<'a, U16Str> {
1334+
impl core::fmt::Display for Display<'_, U16Str> {
13351335
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
13361336
for c in crate::decode_utf16_lossy(self.str.as_slice().iter().copied()) {
13371337
// Allow alternate {:#} format which skips replacment chars entirely
@@ -1343,7 +1343,7 @@ impl<'a> core::fmt::Display for Display<'a, U16Str> {
13431343
}
13441344
}
13451345

1346-
impl<'a> core::fmt::Display for Display<'a, U32Str> {
1346+
impl core::fmt::Display for Display<'_, U32Str> {
13471347
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
13481348
for c in crate::decode_utf32_lossy(self.str.as_slice().iter().copied()) {
13491349
// Allow alternate {:#} format which skips replacment chars entirely

src/ustr/iter.rs

+32-32
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl<'a> CharsUtf16<'a> {
2424
}
2525
}
2626

27-
impl<'a> Iterator for CharsUtf16<'a> {
27+
impl Iterator for CharsUtf16<'_> {
2828
type Item = Result<char, DecodeUtf16Error>;
2929

3030
#[inline]
@@ -38,16 +38,16 @@ impl<'a> Iterator for CharsUtf16<'a> {
3838
}
3939
}
4040

41-
impl<'a> FusedIterator for CharsUtf16<'a> {}
41+
impl FusedIterator for CharsUtf16<'_> {}
4242

43-
impl<'a> DoubleEndedIterator for CharsUtf16<'a> {
43+
impl DoubleEndedIterator for CharsUtf16<'_> {
4444
#[inline]
4545
fn next_back(&mut self) -> Option<Self::Item> {
4646
self.inner.next_back()
4747
}
4848
}
4949

50-
impl<'a> core::fmt::Debug for CharsUtf16<'a> {
50+
impl core::fmt::Debug for CharsUtf16<'_> {
5151
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
5252
crate::debug_fmt_utf16_iter(self.clone(), f)
5353
}
@@ -69,7 +69,7 @@ impl<'a> CharsUtf32<'a> {
6969
}
7070
}
7171

72-
impl<'a> Iterator for CharsUtf32<'a> {
72+
impl Iterator for CharsUtf32<'_> {
7373
type Item = Result<char, DecodeUtf32Error>;
7474

7575
#[inline]
@@ -83,23 +83,23 @@ impl<'a> Iterator for CharsUtf32<'a> {
8383
}
8484
}
8585

86-
impl<'a> FusedIterator for CharsUtf32<'a> {}
86+
impl FusedIterator for CharsUtf32<'_> {}
8787

88-
impl<'a> DoubleEndedIterator for CharsUtf32<'a> {
88+
impl DoubleEndedIterator for CharsUtf32<'_> {
8989
#[inline]
9090
fn next_back(&mut self) -> Option<Self::Item> {
9191
self.inner.next_back()
9292
}
9393
}
9494

95-
impl<'a> ExactSizeIterator for CharsUtf32<'a> {
95+
impl ExactSizeIterator for CharsUtf32<'_> {
9696
#[inline]
9797
fn len(&self) -> usize {
9898
self.inner.len()
9999
}
100100
}
101101

102-
impl<'a> core::fmt::Debug for CharsUtf32<'a> {
102+
impl core::fmt::Debug for CharsUtf32<'_> {
103103
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
104104
crate::debug_fmt_utf32_iter(self.clone(), f)
105105
}
@@ -121,7 +121,7 @@ impl<'a> CharsLossyUtf16<'a> {
121121
}
122122
}
123123

124-
impl<'a> Iterator for CharsLossyUtf16<'a> {
124+
impl Iterator for CharsLossyUtf16<'_> {
125125
type Item = char;
126126

127127
#[inline]
@@ -135,16 +135,16 @@ impl<'a> Iterator for CharsLossyUtf16<'a> {
135135
}
136136
}
137137

138-
impl<'a> FusedIterator for CharsLossyUtf16<'a> {}
138+
impl FusedIterator for CharsLossyUtf16<'_> {}
139139

140-
impl<'a> DoubleEndedIterator for CharsLossyUtf16<'a> {
140+
impl DoubleEndedIterator for CharsLossyUtf16<'_> {
141141
#[inline]
142142
fn next_back(&mut self) -> Option<Self::Item> {
143143
self.iter.next_back()
144144
}
145145
}
146146

147-
impl<'a> core::fmt::Debug for CharsLossyUtf16<'a> {
147+
impl core::fmt::Debug for CharsLossyUtf16<'_> {
148148
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
149149
crate::debug_fmt_char_iter(self.clone(), f)
150150
}
@@ -166,7 +166,7 @@ impl<'a> CharsLossyUtf32<'a> {
166166
}
167167
}
168168

169-
impl<'a> Iterator for CharsLossyUtf32<'a> {
169+
impl Iterator for CharsLossyUtf32<'_> {
170170
type Item = char;
171171

172172
#[inline]
@@ -180,23 +180,23 @@ impl<'a> Iterator for CharsLossyUtf32<'a> {
180180
}
181181
}
182182

183-
impl<'a> FusedIterator for CharsLossyUtf32<'a> {}
183+
impl FusedIterator for CharsLossyUtf32<'_> {}
184184

185-
impl<'a> DoubleEndedIterator for CharsLossyUtf32<'a> {
185+
impl DoubleEndedIterator for CharsLossyUtf32<'_> {
186186
#[inline]
187187
fn next_back(&mut self) -> Option<Self::Item> {
188188
self.iter.next_back()
189189
}
190190
}
191191

192-
impl<'a> ExactSizeIterator for CharsLossyUtf32<'a> {
192+
impl ExactSizeIterator for CharsLossyUtf32<'_> {
193193
#[inline]
194194
fn len(&self) -> usize {
195195
self.iter.len()
196196
}
197197
}
198198

199-
impl<'a> core::fmt::Debug for CharsLossyUtf32<'a> {
199+
impl core::fmt::Debug for CharsLossyUtf32<'_> {
200200
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
201201
crate::debug_fmt_char_iter(self.clone(), f)
202202
}
@@ -230,7 +230,7 @@ impl<'a> CharIndicesUtf16<'a> {
230230
}
231231
}
232232

233-
impl<'a> Iterator for CharIndicesUtf16<'a> {
233+
impl Iterator for CharIndicesUtf16<'_> {
234234
type Item = (usize, Result<char, DecodeUtf16Error>);
235235

236236
fn next(&mut self) -> Option<Self::Item> {
@@ -255,9 +255,9 @@ impl<'a> Iterator for CharIndicesUtf16<'a> {
255255
}
256256
}
257257

258-
impl<'a> FusedIterator for CharIndicesUtf16<'a> {}
258+
impl FusedIterator for CharIndicesUtf16<'_> {}
259259

260-
impl<'a> DoubleEndedIterator for CharIndicesUtf16<'a> {
260+
impl DoubleEndedIterator for CharIndicesUtf16<'_> {
261261
#[inline]
262262
fn next_back(&mut self) -> Option<Self::Item> {
263263
match self.iter.next_back() {
@@ -302,7 +302,7 @@ impl<'a> CharIndicesUtf32<'a> {
302302
}
303303
}
304304

305-
impl<'a> Iterator for CharIndicesUtf32<'a> {
305+
impl Iterator for CharIndicesUtf32<'_> {
306306
type Item = (usize, Result<char, DecodeUtf32Error>);
307307

308308
fn next(&mut self) -> Option<Self::Item> {
@@ -327,9 +327,9 @@ impl<'a> Iterator for CharIndicesUtf32<'a> {
327327
}
328328
}
329329

330-
impl<'a> FusedIterator for CharIndicesUtf32<'a> {}
330+
impl FusedIterator for CharIndicesUtf32<'_> {}
331331

332-
impl<'a> DoubleEndedIterator for CharIndicesUtf32<'a> {
332+
impl DoubleEndedIterator for CharIndicesUtf32<'_> {
333333
#[inline]
334334
fn next_back(&mut self) -> Option<Self::Item> {
335335
match self.iter.next_back() {
@@ -346,7 +346,7 @@ impl<'a> DoubleEndedIterator for CharIndicesUtf32<'a> {
346346
}
347347
}
348348

349-
impl<'a> ExactSizeIterator for CharIndicesUtf32<'a> {
349+
impl ExactSizeIterator for CharIndicesUtf32<'_> {
350350
#[inline]
351351
fn len(&self) -> usize {
352352
self.iter.len()
@@ -381,7 +381,7 @@ impl<'a> CharIndicesLossyUtf16<'a> {
381381
}
382382
}
383383

384-
impl<'a> Iterator for CharIndicesLossyUtf16<'a> {
384+
impl Iterator for CharIndicesLossyUtf16<'_> {
385385
type Item = (usize, char);
386386

387387
#[inline]
@@ -402,9 +402,9 @@ impl<'a> Iterator for CharIndicesLossyUtf16<'a> {
402402
}
403403
}
404404

405-
impl<'a> FusedIterator for CharIndicesLossyUtf16<'a> {}
405+
impl FusedIterator for CharIndicesLossyUtf16<'_> {}
406406

407-
impl<'a> DoubleEndedIterator for CharIndicesLossyUtf16<'a> {
407+
impl DoubleEndedIterator for CharIndicesLossyUtf16<'_> {
408408
#[inline]
409409
fn next_back(&mut self) -> Option<Self::Item> {
410410
match self.iter.next_back() {
@@ -445,7 +445,7 @@ impl<'a> CharIndicesLossyUtf32<'a> {
445445
}
446446
}
447447

448-
impl<'a> Iterator for CharIndicesLossyUtf32<'a> {
448+
impl Iterator for CharIndicesLossyUtf32<'_> {
449449
type Item = (usize, char);
450450

451451
#[inline]
@@ -466,9 +466,9 @@ impl<'a> Iterator for CharIndicesLossyUtf32<'a> {
466466
}
467467
}
468468

469-
impl<'a> FusedIterator for CharIndicesLossyUtf32<'a> {}
469+
impl FusedIterator for CharIndicesLossyUtf32<'_> {}
470470

471-
impl<'a> DoubleEndedIterator for CharIndicesLossyUtf32<'a> {
471+
impl DoubleEndedIterator for CharIndicesLossyUtf32<'_> {
472472
#[inline]
473473
fn next_back(&mut self) -> Option<Self::Item> {
474474
match self.iter.next_back() {
@@ -481,7 +481,7 @@ impl<'a> DoubleEndedIterator for CharIndicesLossyUtf32<'a> {
481481
}
482482
}
483483

484-
impl<'a> ExactSizeIterator for CharIndicesLossyUtf32<'a> {
484+
impl ExactSizeIterator for CharIndicesLossyUtf32<'_> {
485485
#[inline]
486486
fn len(&self) -> usize {
487487
self.iter.len()

0 commit comments

Comments
 (0)