Skip to content

Commit bb07131

Browse files
committed
Fix clippy lints.
1 parent 4765111 commit bb07131

File tree

6 files changed

+30
-34
lines changed

6 files changed

+30
-34
lines changed

src/cow_rc_str.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl<'a> From<&'a str> for CowRcStr<'a> {
5151
}
5252
}
5353

54-
impl<'a> From<String> for CowRcStr<'a> {
54+
impl From<String> for CowRcStr<'_> {
5555
#[inline]
5656
fn from(s: String) -> Self {
5757
CowRcStr::from_rc(Rc::new(s))
@@ -84,7 +84,7 @@ impl<'a> CowRcStr<'a> {
8484
}
8585
}
8686

87-
impl<'a> Clone for CowRcStr<'a> {
87+
impl Clone for CowRcStr<'_> {
8888
#[inline]
8989
fn clone(&self) -> Self {
9090
match self.unpack() {
@@ -99,7 +99,7 @@ impl<'a> Clone for CowRcStr<'a> {
9999
}
100100
}
101101

102-
impl<'a> Drop for CowRcStr<'a> {
102+
impl Drop for CowRcStr<'_> {
103103
#[inline]
104104
fn drop(&mut self) {
105105
if let Err(ptr) = self.unpack() {
@@ -108,7 +108,7 @@ impl<'a> Drop for CowRcStr<'a> {
108108
}
109109
}
110110

111-
impl<'a> ops::Deref for CowRcStr<'a> {
111+
impl ops::Deref for CowRcStr<'_> {
112112
type Target = str;
113113

114114
#[inline]
@@ -119,65 +119,65 @@ impl<'a> ops::Deref for CowRcStr<'a> {
119119

120120
// Boilerplate / trivial impls below.
121121

122-
impl<'a> AsRef<str> for CowRcStr<'a> {
122+
impl AsRef<str> for CowRcStr<'_> {
123123
#[inline]
124124
fn as_ref(&self) -> &str {
125125
self
126126
}
127127
}
128128

129-
impl<'a> Borrow<str> for CowRcStr<'a> {
129+
impl Borrow<str> for CowRcStr<'_> {
130130
#[inline]
131131
fn borrow(&self) -> &str {
132132
self
133133
}
134134
}
135135

136-
impl<'a> Default for CowRcStr<'a> {
136+
impl Default for CowRcStr<'_> {
137137
#[inline]
138138
fn default() -> Self {
139139
Self::from("")
140140
}
141141
}
142142

143-
impl<'a> hash::Hash for CowRcStr<'a> {
143+
impl hash::Hash for CowRcStr<'_> {
144144
#[inline]
145145
fn hash<H: hash::Hasher>(&self, hasher: &mut H) {
146146
str::hash(self, hasher)
147147
}
148148
}
149149

150-
impl<'a, T: AsRef<str>> PartialEq<T> for CowRcStr<'a> {
150+
impl<T: AsRef<str>> PartialEq<T> for CowRcStr<'_> {
151151
#[inline]
152152
fn eq(&self, other: &T) -> bool {
153153
str::eq(self, other.as_ref())
154154
}
155155
}
156156

157-
impl<'a, T: AsRef<str>> PartialOrd<T> for CowRcStr<'a> {
157+
impl<T: AsRef<str>> PartialOrd<T> for CowRcStr<'_> {
158158
#[inline]
159159
fn partial_cmp(&self, other: &T) -> Option<cmp::Ordering> {
160160
str::partial_cmp(self, other.as_ref())
161161
}
162162
}
163163

164-
impl<'a> Eq for CowRcStr<'a> {}
164+
impl Eq for CowRcStr<'_> {}
165165

166-
impl<'a> Ord for CowRcStr<'a> {
166+
impl Ord for CowRcStr<'_> {
167167
#[inline]
168168
fn cmp(&self, other: &Self) -> cmp::Ordering {
169169
str::cmp(self, other)
170170
}
171171
}
172172

173-
impl<'a> fmt::Display for CowRcStr<'a> {
173+
impl fmt::Display for CowRcStr<'_> {
174174
#[inline]
175175
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
176176
str::fmt(self, formatter)
177177
}
178178
}
179179

180-
impl<'a> fmt::Debug for CowRcStr<'a> {
180+
impl fmt::Debug for CowRcStr<'_> {
181181
#[inline]
182182
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
183183
str::fmt(self, formatter)

src/parser.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub enum BasicParseErrorKind<'i> {
7676
QualifiedRuleInvalid,
7777
}
7878

79-
impl<'i> fmt::Display for BasicParseErrorKind<'i> {
79+
impl fmt::Display for BasicParseErrorKind<'_> {
8080
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
8181
match self {
8282
BasicParseErrorKind::UnexpectedToken(token) => {
@@ -176,7 +176,7 @@ impl<'i, T> ParseErrorKind<'i, T> {
176176
}
177177
}
178178

179-
impl<'i, E: fmt::Display> fmt::Display for ParseErrorKind<'i, E> {
179+
impl<E: fmt::Display> fmt::Display for ParseErrorKind<'_, E> {
180180
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
181181
match self {
182182
ParseErrorKind::Basic(ref basic) => basic.fmt(f),
@@ -218,13 +218,13 @@ impl<'i, T> ParseError<'i, T> {
218218
}
219219
}
220220

221-
impl<'i, E: fmt::Display> fmt::Display for ParseError<'i, E> {
221+
impl<E: fmt::Display> fmt::Display for ParseError<'_, E> {
222222
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
223223
self.kind.fmt(f)
224224
}
225225
}
226226

227-
impl<'i, E: fmt::Display + fmt::Debug> std::error::Error for ParseError<'i, E> {}
227+
impl<E: fmt::Display + fmt::Debug> std::error::Error for ParseError<'_, E> {}
228228

229229
/// The owned input for a parser.
230230
pub struct ParserInput<'i> {

src/rules_and_declarations.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ impl<'i, 't, 'a, P, I, E> RuleBodyParser<'i, 't, 'a, P, I, E> {
241241
}
242242

243243
/// https://drafts.csswg.org/css-syntax/#consume-a-blocks-contents
244-
impl<'i, 't, 'a, I, P, E: 'i> Iterator for RuleBodyParser<'i, 't, 'a, P, I, E>
244+
impl<'i, I, P, E: 'i> Iterator for RuleBodyParser<'i, '_, '_, P, I, E>
245245
where
246246
P: RuleBodyItemParser<'i, I, E>,
247247
{
@@ -349,7 +349,7 @@ where
349349
}
350350

351351
/// `RuleListParser` is an iterator that yields `Ok(_)` for a rule or an `Err(..)` for an invalid one.
352-
impl<'i, 't, 'a, R, P, E: 'i> Iterator for StyleSheetParser<'i, 't, 'a, P>
352+
impl<'i, R, P, E: 'i> Iterator for StyleSheetParser<'i, '_, '_, P>
353353
where
354354
P: QualifiedRuleParser<'i, QualifiedRule = R, Error = E>
355355
+ AtRuleParser<'i, AtRule = R, Error = E>,

src/serializer.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ where
5555
Ok(())
5656
}
5757

58-
impl<'a> ToCss for Token<'a> {
58+
impl ToCss for Token<'_> {
5959
fn to_css<W>(&self, dest: &mut W) -> fmt::Result
6060
where
6161
W: fmt::Write,
@@ -311,7 +311,7 @@ where
311311
}
312312
}
313313

314-
impl<'a, W> fmt::Write for CssStringWriter<'a, W>
314+
impl<W> fmt::Write for CssStringWriter<'_, W>
315315
where
316316
W: fmt::Write,
317317
{
@@ -539,7 +539,7 @@ impl TokenSerializationType {
539539
}
540540
}
541541

542-
impl<'a> Token<'a> {
542+
impl Token<'_> {
543543
/// Categorize a token into a type that determines when `/**/` needs to be inserted
544544
/// between two tokens when serialized next to each other without whitespace in between.
545545
///

src/tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ where
773773
}
774774
}
775775

776-
impl<'a> ToJson for CowRcStr<'a> {
776+
impl ToJson for CowRcStr<'_> {
777777
fn to_json(&self) -> Value {
778778
let s: &str = self;
779779
s.to_json()
@@ -946,7 +946,7 @@ impl<'i> QualifiedRuleParser<'i> for JsonParser {
946946
}
947947
}
948948

949-
impl<'i> RuleBodyItemParser<'i, Value, ()> for JsonParser {
949+
impl RuleBodyItemParser<'_, Value, ()> for JsonParser {
950950
fn parse_qualified(&self) -> bool {
951951
true
952952
}

src/tokenizer.rs

+5-9
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ pub enum Token<'a> {
190190
CloseCurlyBracket,
191191
}
192192

193-
impl<'a> Token<'a> {
193+
impl Token<'_> {
194194
/// Return whether this token represents a parse error.
195195
///
196196
/// `BadUrl` and `BadString` are tokenizer-level parse errors.
@@ -324,11 +324,11 @@ impl<'a> Tokenizer<'a> {
324324
let current = self.position();
325325
let start = self
326326
.slice(SourcePosition(0)..current)
327-
.rfind(|c| matches!(c, '\r' | '\n' | '\x0C'))
327+
.rfind(['\r', '\n', '\x0C'])
328328
.map_or(0, |start| start + 1);
329329
let end = self
330330
.slice(current..SourcePosition(self.input.len()))
331-
.find(|c| matches!(c, '\r' | '\n' | '\x0C'))
331+
.find(['\r', '\n', '\x0C'])
332332
.map_or(self.input.len(), |end| current.0 + end);
333333
self.slice(SourcePosition(start)..SourcePosition(end))
334334
}
@@ -720,9 +720,7 @@ fn check_for_source_map<'a>(tokenizer: &mut Tokenizer<'a>, contents: &'a str) {
720720
// If there is a source map directive, extract the URL.
721721
if contents.starts_with(directive) || contents.starts_with(directive_old) {
722722
let contents = &contents[directive.len()..];
723-
tokenizer.source_map_url = contents
724-
.split(|c| c == ' ' || c == '\t' || c == '\x0C' || c == '\r' || c == '\n')
725-
.next()
723+
tokenizer.source_map_url = contents.split([' ', '\t', '\x0C', '\r', '\n']).next();
726724
}
727725

728726
let directive = "# sourceURL=";
@@ -731,9 +729,7 @@ fn check_for_source_map<'a>(tokenizer: &mut Tokenizer<'a>, contents: &'a str) {
731729
// If there is a source map directive, extract the URL.
732730
if contents.starts_with(directive) || contents.starts_with(directive_old) {
733731
let contents = &contents[directive.len()..];
734-
tokenizer.source_url = contents
735-
.split(|c| c == ' ' || c == '\t' || c == '\x0C' || c == '\r' || c == '\n')
736-
.next()
732+
tokenizer.source_url = contents.split([' ', '\t', '\x0C', '\r', '\n']).next()
737733
}
738734
}
739735

0 commit comments

Comments
 (0)