Skip to content

Commit ffca1ef

Browse files
authored
chore: fix clippy errors on main (#1019)
* chore: fix clippy errors on main * more fixes * format * maybe fix ci
1 parent 84cf467 commit ffca1ef

File tree

9 files changed

+26
-27
lines changed

9 files changed

+26
-27
lines changed

.github/workflows/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ jobs:
9595
{
9696
echo "leak:dyld4::RuntimeState"
9797
echo "leak:fetchInitializingClassList"
98+
echo "leak:std::sys::pal::unix::stack_overflow::imp::init"
9899
} > suppressions.txt
99100
export LSAN_OPTIONS="suppressions=$(pwd)/suppressions.txt"
100101
fi

data-url/src/lib.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<'a> DataUrl<'a> {
124124
/// The URL’s fragment identifier (after `#`)
125125
pub struct FragmentIdentifier<'a>(&'a str);
126126

127-
impl<'a> FragmentIdentifier<'a> {
127+
impl FragmentIdentifier<'_> {
128128
/// Like in a parsed URL
129129
pub fn to_percent_encoded(&self) -> String {
130130
let mut string = String::new();
@@ -165,10 +165,10 @@ fn pretend_parse_data_url(input: &str) -> Option<&str> {
165165
let mut iter = bytes
166166
.by_ref()
167167
.filter(|&byte| !matches!(byte, b'\t' | b'\n' | b'\r'));
168-
require!(iter.next()?.to_ascii_lowercase() == b'd');
169-
require!(iter.next()?.to_ascii_lowercase() == b'a');
170-
require!(iter.next()?.to_ascii_lowercase() == b't');
171-
require!(iter.next()?.to_ascii_lowercase() == b'a');
168+
require!(iter.next()?.eq_ignore_ascii_case(&b'd'));
169+
require!(iter.next()?.eq_ignore_ascii_case(&b'a'));
170+
require!(iter.next()?.eq_ignore_ascii_case(&b't'));
171+
require!(iter.next()?.eq_ignore_ascii_case(&b'a'));
172172
require!(iter.next()? == b':');
173173
}
174174
let bytes_consumed = left_trimmed.len() - bytes.len();
@@ -256,10 +256,10 @@ fn remove_base64_suffix(s: &str) -> Option<&str> {
256256

257257
require!(iter.next()? == b'4');
258258
require!(iter.next()? == b'6');
259-
require!(iter.next()?.to_ascii_lowercase() == b'e');
260-
require!(iter.next()?.to_ascii_lowercase() == b's');
261-
require!(iter.next()?.to_ascii_lowercase() == b'a');
262-
require!(iter.next()?.to_ascii_lowercase() == b'b');
259+
require!(iter.next()?.eq_ignore_ascii_case(&b'e'));
260+
require!(iter.next()?.eq_ignore_ascii_case(&b's'));
261+
require!(iter.next()?.eq_ignore_ascii_case(&b'a'));
262+
require!(iter.next()?.eq_ignore_ascii_case(&b'b'));
263263
require!(iter.skip_while(|&byte| byte == b' ').next()? == b';');
264264
}
265265
Some(&s[..bytes.len()])

form_urlencoded/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pub struct ParseIntoOwned<'a> {
104104
inner: Parse<'a>,
105105
}
106106

107-
impl<'a> Iterator for ParseIntoOwned<'a> {
107+
impl Iterator for ParseIntoOwned<'_> {
108108
type Item = (String, String);
109109

110110
fn next(&mut self) -> Option<Self::Item> {
@@ -195,7 +195,7 @@ impl Target for String {
195195
type Finished = Self;
196196
}
197197

198-
impl<'a> Target for &'a mut String {
198+
impl Target for &mut String {
199199
fn as_mut_string(&mut self) -> &mut String {
200200
self
201201
}

idna/src/punycode.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ where
277277
phantom: PhantomData<C>,
278278
}
279279

280-
impl<'a, T: PunycodeCodeUnit + Copy, C: PunycodeCaller> Iterator for Decode<'a, T, C> {
280+
impl<T: PunycodeCodeUnit + Copy, C: PunycodeCaller> Iterator for Decode<'_, T, C> {
281281
type Item = char;
282282

283283
fn next(&mut self) -> Option<Self::Item> {
@@ -309,7 +309,7 @@ impl<'a, T: PunycodeCodeUnit + Copy, C: PunycodeCaller> Iterator for Decode<'a,
309309
}
310310
}
311311

312-
impl<'a, T: PunycodeCodeUnit + Copy, C: PunycodeCaller> ExactSizeIterator for Decode<'a, T, C> {
312+
impl<T: PunycodeCodeUnit + Copy, C: PunycodeCaller> ExactSizeIterator for Decode<'_, T, C> {
313313
fn len(&self) -> usize {
314314
self.len - self.position
315315
}

percent_encoding/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl<'a> Iterator for PercentEncode<'a> {
181181
}
182182
}
183183

184-
impl<'a> fmt::Display for PercentEncode<'a> {
184+
impl fmt::Display for PercentEncode<'_> {
185185
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
186186
for c in (*self).clone() {
187187
formatter.write_str(c)?
@@ -257,7 +257,7 @@ fn after_percent_sign(iter: &mut slice::Iter<'_, u8>) -> Option<u8> {
257257
Some(h as u8 * 0x10 + l as u8)
258258
}
259259

260-
impl<'a> Iterator for PercentDecode<'a> {
260+
impl Iterator for PercentDecode<'_> {
261261
type Item = u8;
262262

263263
fn next(&mut self) -> Option<u8> {

url/src/host.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub enum Host<S = String> {
6464
Ipv6(Ipv6Addr),
6565
}
6666

67-
impl<'a> Host<&'a str> {
67+
impl Host<&str> {
6868
/// Return a copy of `self` that owns an allocated `String` but does not borrow an `&Url`.
6969
pub fn to_owned(&self) -> Host<String> {
7070
match *self {

url/src/lib.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ impl Url {
448448
/// let base = Url::parse("https://alice.com/a")?;
449449
/// let url = base.join("http://eve.com/b")?;
450450
/// assert_eq!(url.as_str(), "http://eve.com/b"); // http instead of https
451-
451+
///
452452
/// # Ok(())
453453
/// # }
454454
/// # run().unwrap();
@@ -1492,7 +1492,6 @@ impl Url {
14921492
/// # }
14931493
/// # run().unwrap();
14941494
/// ```
1495-
14961495
#[inline]
14971496
pub fn query_pairs(&self) -> form_urlencoded::Parse<'_> {
14981497
form_urlencoded::parse(self.query().unwrap_or("").as_bytes())
@@ -1555,7 +1554,7 @@ impl Url {
15551554
/// # fn run() -> Result<(), ParseError> {
15561555
/// let mut url = Url::parse("https://example.com/data.csv")?;
15571556
/// assert_eq!(url.as_str(), "https://example.com/data.csv");
1558-
1557+
///
15591558
/// url.set_fragment(Some("cell=4,1-6,2"));
15601559
/// assert_eq!(url.as_str(), "https://example.com/data.csv#cell=4,1-6,2");
15611560
/// assert_eq!(url.fragment(), Some("cell=4,1-6,2"));
@@ -2674,8 +2673,7 @@ impl Url {
26742673
fragment_start,
26752674
};
26762675
if cfg!(debug_assertions) {
2677-
url.check_invariants()
2678-
.map_err(|reason| Error::custom(reason))?
2676+
url.check_invariants().map_err(Error::custom)?
26792677
}
26802678
Ok(url)
26812679
}
@@ -2892,7 +2890,7 @@ impl<'de> serde::Deserialize<'de> for Url {
28922890

28932891
struct UrlVisitor;
28942892

2895-
impl<'de> Visitor<'de> for UrlVisitor {
2893+
impl Visitor<'_> for UrlVisitor {
28962894
type Value = Url;
28972895

28982896
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@@ -3177,7 +3175,7 @@ impl<'a> form_urlencoded::Target for UrlQuery<'a> {
31773175
type Finished = &'a mut Url;
31783176
}
31793177

3180-
impl<'a> Drop for UrlQuery<'a> {
3178+
impl Drop for UrlQuery<'_> {
31813179
fn drop(&mut self) {
31823180
if let Some(url) = self.url.take() {
31833181
url.restore_already_parsed_fragment(self.fragment.take())

url/src/parser.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ impl Pattern for char {
301301
}
302302
}
303303

304-
impl<'a> Pattern for &'a str {
304+
impl Pattern for &str {
305305
fn split_prefix(self, input: &mut Input) -> bool {
306306
for c in self.chars() {
307307
if input.next() != Some(c) {
@@ -318,7 +318,7 @@ impl<F: FnMut(char) -> bool> Pattern for F {
318318
}
319319
}
320320

321-
impl<'i> Iterator for Input<'i> {
321+
impl Iterator for Input<'_> {
322322
type Item = char;
323323
fn next(&mut self) -> Option<char> {
324324
self.chars

url/src/path_segments.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ pub fn new(url: &mut Url) -> PathSegmentsMut<'_> {
6767
}
6868
}
6969

70-
impl<'a> Drop for PathSegmentsMut<'a> {
70+
impl Drop for PathSegmentsMut<'_> {
7171
fn drop(&mut self) {
7272
self.url
7373
.restore_after_path(self.old_after_path_position, &self.after_path)
7474
}
7575
}
7676

77-
impl<'a> PathSegmentsMut<'a> {
77+
impl PathSegmentsMut<'_> {
7878
/// Remove all segments in the path, leaving the minimal `url.path() == "/"`.
7979
///
8080
/// Returns `&mut Self` so that method calls can be chained.

0 commit comments

Comments
 (0)