Skip to content

Commit 5f0c866

Browse files
authored
style: remove unnecessary explicit lifetimes (#815)
Partially automated with cargo clippy --fix.
1 parent e9de46c commit 5f0c866

10 files changed

Lines changed: 93 additions & 93 deletions

File tree

src/byte_str.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ impl From<String> for ByteStr {
7474
}
7575
}
7676

77-
impl<'a> From<&'a str> for ByteStr {
77+
impl From<&str> for ByteStr {
7878
#[inline]
79-
fn from(src: &'a str) -> ByteStr {
79+
fn from(src: &str) -> ByteStr {
8080
ByteStr {
8181
// Invariant: src is a str so contains valid UTF-8.
8282
bytes: Bytes::copy_from_slice(src.as_bytes()),

src/header/map.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3758,7 +3758,7 @@ mod into_header_name {
37583758

37593759
impl IntoHeaderName for HeaderName {}
37603760

3761-
impl<'a> Sealed for &'a HeaderName {
3761+
impl Sealed for &HeaderName {
37623762
#[inline]
37633763
fn try_insert<T>(
37643764
self,
@@ -3778,7 +3778,7 @@ mod into_header_name {
37783778
}
37793779
}
37803780

3781-
impl<'a> IntoHeaderName for &'a HeaderName {}
3781+
impl IntoHeaderName for &HeaderName {}
37823782

37833783
impl Sealed for &'static str {
37843784
#[inline]
@@ -3868,7 +3868,7 @@ mod as_header_name {
38683868

38693869
impl AsHeaderName for HeaderName {}
38703870

3871-
impl<'a> Sealed for &'a HeaderName {
3871+
impl Sealed for &HeaderName {
38723872
#[inline]
38733873
fn try_entry<T>(self, map: &mut HeaderMap<T>) -> Result<Entry<'_, T>, TryEntryError> {
38743874
Ok(map.try_entry2(self)?)
@@ -3884,9 +3884,9 @@ mod as_header_name {
38843884
}
38853885
}
38863886

3887-
impl<'a> AsHeaderName for &'a HeaderName {}
3887+
impl AsHeaderName for &HeaderName {}
38883888

3889-
impl<'a> Sealed for &'a str {
3889+
impl Sealed for &str {
38903890
#[inline]
38913891
fn try_entry<T>(self, map: &mut HeaderMap<T>) -> Result<Entry<'_, T>, TryEntryError> {
38923892
Ok(HdrName::from_bytes(self.as_bytes(), move |hdr| {
@@ -3904,7 +3904,7 @@ mod as_header_name {
39043904
}
39053905
}
39063906

3907-
impl<'a> AsHeaderName for &'a str {}
3907+
impl AsHeaderName for &str {}
39083908

39093909
impl Sealed for String {
39103910
#[inline]
@@ -3924,7 +3924,7 @@ mod as_header_name {
39243924

39253925
impl AsHeaderName for String {}
39263926

3927-
impl<'a> Sealed for &'a String {
3927+
impl Sealed for &String {
39283928
#[inline]
39293929
fn try_entry<T>(self, map: &mut HeaderMap<T>) -> Result<Entry<'_, T>, TryEntryError> {
39303930
self.as_str().try_entry(map)
@@ -3940,7 +3940,7 @@ mod as_header_name {
39403940
}
39413941
}
39423942

3943-
impl<'a> AsHeaderName for &'a String {}
3943+
impl AsHeaderName for &String {}
39443944
}
39453945

39463946
#[test]

src/header/name.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,8 +1319,8 @@ impl InvalidHeaderName {
13191319
}
13201320
}
13211321

1322-
impl<'a> From<&'a HeaderName> for HeaderName {
1323-
fn from(src: &'a HeaderName) -> HeaderName {
1322+
impl From<&HeaderName> for HeaderName {
1323+
fn from(src: &HeaderName) -> HeaderName {
13241324
src.clone()
13251325
}
13261326
}
@@ -1345,26 +1345,26 @@ impl From<Custom> for Bytes {
13451345
}
13461346
}
13471347

1348-
impl<'a> TryFrom<&'a str> for HeaderName {
1348+
impl TryFrom<&str> for HeaderName {
13491349
type Error = InvalidHeaderName;
13501350
#[inline]
1351-
fn try_from(s: &'a str) -> Result<Self, Self::Error> {
1351+
fn try_from(s: &str) -> Result<Self, Self::Error> {
13521352
Self::from_bytes(s.as_bytes())
13531353
}
13541354
}
13551355

1356-
impl<'a> TryFrom<&'a String> for HeaderName {
1356+
impl TryFrom<&String> for HeaderName {
13571357
type Error = InvalidHeaderName;
13581358
#[inline]
1359-
fn try_from(s: &'a String) -> Result<Self, Self::Error> {
1359+
fn try_from(s: &String) -> Result<Self, Self::Error> {
13601360
Self::from_bytes(s.as_bytes())
13611361
}
13621362
}
13631363

1364-
impl<'a> TryFrom<&'a [u8]> for HeaderName {
1364+
impl TryFrom<&[u8]> for HeaderName {
13651365
type Error = InvalidHeaderName;
13661366
#[inline]
1367-
fn try_from(s: &'a [u8]) -> Result<Self, Self::Error> {
1367+
fn try_from(s: &[u8]) -> Result<Self, Self::Error> {
13681368
Self::from_bytes(s)
13691369
}
13701370
}
@@ -1405,14 +1405,14 @@ impl From<Custom> for HeaderName {
14051405
}
14061406
}
14071407

1408-
impl<'a> PartialEq<&'a HeaderName> for HeaderName {
1408+
impl PartialEq<&HeaderName> for HeaderName {
14091409
#[inline]
1410-
fn eq(&self, other: &&'a HeaderName) -> bool {
1410+
fn eq(&self, other: &&HeaderName) -> bool {
14111411
*self == **other
14121412
}
14131413
}
14141414

1415-
impl<'a> PartialEq<HeaderName> for &'a HeaderName {
1415+
impl PartialEq<HeaderName> for &HeaderName {
14161416
#[inline]
14171417
fn eq(&self, other: &HeaderName) -> bool {
14181418
*other == *self
@@ -1457,16 +1457,16 @@ impl PartialEq<HeaderName> for str {
14571457
}
14581458
}
14591459

1460-
impl<'a> PartialEq<&'a str> for HeaderName {
1460+
impl PartialEq<&str> for HeaderName {
14611461
/// Performs a case-insensitive comparison of the string against the header
14621462
/// name
14631463
#[inline]
1464-
fn eq(&self, other: &&'a str) -> bool {
1464+
fn eq(&self, other: &&str) -> bool {
14651465
*self == **other
14661466
}
14671467
}
14681468

1469-
impl<'a> PartialEq<HeaderName> for &'a str {
1469+
impl PartialEq<HeaderName> for &str {
14701470
/// Performs a case-insensitive comparison of the string against the header
14711471
/// name
14721472
#[inline]

src/header/value.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -484,35 +484,35 @@ impl FromStr for HeaderValue {
484484
}
485485
}
486486

487-
impl<'a> From<&'a HeaderValue> for HeaderValue {
487+
impl From<&HeaderValue> for HeaderValue {
488488
#[inline]
489-
fn from(t: &'a HeaderValue) -> Self {
489+
fn from(t: &HeaderValue) -> Self {
490490
t.clone()
491491
}
492492
}
493493

494-
impl<'a> TryFrom<&'a str> for HeaderValue {
494+
impl TryFrom<&str> for HeaderValue {
495495
type Error = InvalidHeaderValue;
496496

497497
#[inline]
498-
fn try_from(t: &'a str) -> Result<Self, Self::Error> {
498+
fn try_from(t: &str) -> Result<Self, Self::Error> {
499499
t.parse()
500500
}
501501
}
502502

503-
impl<'a> TryFrom<&'a String> for HeaderValue {
503+
impl TryFrom<&String> for HeaderValue {
504504
type Error = InvalidHeaderValue;
505505
#[inline]
506-
fn try_from(s: &'a String) -> Result<Self, Self::Error> {
506+
fn try_from(s: &String) -> Result<Self, Self::Error> {
507507
Self::from_bytes(s.as_bytes())
508508
}
509509
}
510510

511-
impl<'a> TryFrom<&'a [u8]> for HeaderValue {
511+
impl TryFrom<&[u8]> for HeaderValue {
512512
type Error = InvalidHeaderValue;
513513

514514
#[inline]
515-
fn try_from(t: &'a [u8]) -> Result<Self, Self::Error> {
515+
fn try_from(t: &[u8]) -> Result<Self, Self::Error> {
516516
HeaderValue::from_bytes(t)
517517
}
518518
}
@@ -697,48 +697,48 @@ impl PartialOrd<HeaderValue> for String {
697697
}
698698
}
699699

700-
impl<'a> PartialEq<HeaderValue> for &'a HeaderValue {
700+
impl PartialEq<HeaderValue> for &HeaderValue {
701701
#[inline]
702702
fn eq(&self, other: &HeaderValue) -> bool {
703703
**self == *other
704704
}
705705
}
706706

707-
impl<'a> PartialOrd<HeaderValue> for &'a HeaderValue {
707+
impl PartialOrd<HeaderValue> for &HeaderValue {
708708
#[inline]
709709
fn partial_cmp(&self, other: &HeaderValue) -> Option<cmp::Ordering> {
710710
(**self).partial_cmp(other)
711711
}
712712
}
713713

714-
impl<'a, T: ?Sized> PartialEq<&'a T> for HeaderValue
714+
impl<T: ?Sized> PartialEq<&T> for HeaderValue
715715
where
716716
HeaderValue: PartialEq<T>,
717717
{
718718
#[inline]
719-
fn eq(&self, other: &&'a T) -> bool {
719+
fn eq(&self, other: &&T) -> bool {
720720
*self == **other
721721
}
722722
}
723723

724-
impl<'a, T: ?Sized> PartialOrd<&'a T> for HeaderValue
724+
impl<T: ?Sized> PartialOrd<&T> for HeaderValue
725725
where
726726
HeaderValue: PartialOrd<T>,
727727
{
728728
#[inline]
729-
fn partial_cmp(&self, other: &&'a T) -> Option<cmp::Ordering> {
729+
fn partial_cmp(&self, other: &&T) -> Option<cmp::Ordering> {
730730
self.partial_cmp(*other)
731731
}
732732
}
733733

734-
impl<'a> PartialEq<HeaderValue> for &'a str {
734+
impl PartialEq<HeaderValue> for &str {
735735
#[inline]
736736
fn eq(&self, other: &HeaderValue) -> bool {
737737
*other == *self
738738
}
739739
}
740740

741-
impl<'a> PartialOrd<HeaderValue> for &'a str {
741+
impl PartialOrd<HeaderValue> for &str {
742742
#[inline]
743743
fn partial_cmp(&self, other: &HeaderValue) -> Option<cmp::Ordering> {
744744
self.as_bytes().partial_cmp(other.as_bytes())

src/method.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,14 @@ impl AsRef<str> for Method {
187187
}
188188
}
189189

190-
impl<'a> PartialEq<&'a Method> for Method {
190+
impl PartialEq<&Method> for Method {
191191
#[inline]
192-
fn eq(&self, other: &&'a Method) -> bool {
192+
fn eq(&self, other: &&Method) -> bool {
193193
self == *other
194194
}
195195
}
196196

197-
impl<'a> PartialEq<Method> for &'a Method {
197+
impl PartialEq<Method> for &Method {
198198
#[inline]
199199
fn eq(&self, other: &Method) -> bool {
200200
*self == other
@@ -215,14 +215,14 @@ impl PartialEq<Method> for str {
215215
}
216216
}
217217

218-
impl<'a> PartialEq<&'a str> for Method {
218+
impl PartialEq<&str> for Method {
219219
#[inline]
220-
fn eq(&self, other: &&'a str) -> bool {
220+
fn eq(&self, other: &&str) -> bool {
221221
self.as_ref() == *other
222222
}
223223
}
224224

225-
impl<'a> PartialEq<Method> for &'a str {
225+
impl PartialEq<Method> for &str {
226226
#[inline]
227227
fn eq(&self, other: &Method) -> bool {
228228
*self == other.as_ref()
@@ -248,27 +248,27 @@ impl Default for Method {
248248
}
249249
}
250250

251-
impl<'a> From<&'a Method> for Method {
251+
impl From<&Method> for Method {
252252
#[inline]
253-
fn from(t: &'a Method) -> Self {
253+
fn from(t: &Method) -> Self {
254254
t.clone()
255255
}
256256
}
257257

258-
impl<'a> TryFrom<&'a [u8]> for Method {
258+
impl TryFrom<&[u8]> for Method {
259259
type Error = InvalidMethod;
260260

261261
#[inline]
262-
fn try_from(t: &'a [u8]) -> Result<Self, Self::Error> {
262+
fn try_from(t: &[u8]) -> Result<Self, Self::Error> {
263263
Method::from_bytes(t)
264264
}
265265
}
266266

267-
impl<'a> TryFrom<&'a str> for Method {
267+
impl TryFrom<&str> for Method {
268268
type Error = InvalidMethod;
269269

270270
#[inline]
271-
fn try_from(t: &'a str) -> Result<Self, Self::Error> {
271+
fn try_from(t: &str) -> Result<Self, Self::Error> {
272272
TryFrom::try_from(t.as_bytes())
273273
}
274274
}

src/status.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,27 +263,27 @@ impl FromStr for StatusCode {
263263
}
264264
}
265265

266-
impl<'a> From<&'a StatusCode> for StatusCode {
266+
impl From<&StatusCode> for StatusCode {
267267
#[inline]
268-
fn from(t: &'a StatusCode) -> Self {
268+
fn from(t: &StatusCode) -> Self {
269269
t.to_owned()
270270
}
271271
}
272272

273-
impl<'a> TryFrom<&'a [u8]> for StatusCode {
273+
impl TryFrom<&[u8]> for StatusCode {
274274
type Error = InvalidStatusCode;
275275

276276
#[inline]
277-
fn try_from(t: &'a [u8]) -> Result<Self, Self::Error> {
277+
fn try_from(t: &[u8]) -> Result<Self, Self::Error> {
278278
StatusCode::from_bytes(t)
279279
}
280280
}
281281

282-
impl<'a> TryFrom<&'a str> for StatusCode {
282+
impl TryFrom<&str> for StatusCode {
283283
type Error = InvalidStatusCode;
284284

285285
#[inline]
286-
fn try_from(t: &'a str) -> Result<Self, Self::Error> {
286+
fn try_from(t: &str) -> Result<Self, Self::Error> {
287287
t.parse()
288288
}
289289
}

0 commit comments

Comments
 (0)