Skip to content

Commit 7611e61

Browse files
authored
style(lib): replace single-character lifetime names with descriptive names (#4173)
1 parent 3b6b700 commit 7611e61

15 files changed

Lines changed: 38 additions & 37 deletions

File tree

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ panic = "allow"
139139
pattern_type_mismatch = "allow"
140140
redundant_closure_for_method_calls = "allow"
141141
redundant_else = "allow"
142-
single_char_lifetime_names = "allow"
143142
struct_excessive_bools = "allow" # TODO: bogus lint?
144143
trivially_copy_pass_by_ref = "allow"
145144
unnecessary_trailing_comma = "allow"

src/client/dispatch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ mod tests {
408408
}
409409

410410
/// Helper to check if the future is ready after polling once.
411-
struct PollOnce<'a, F>(&'a mut F);
411+
struct PollOnce<'fut, F>(&'fut mut F);
412412

413413
impl<F, T> Future for PollOnce<'_, F>
414414
where

src/common/buf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ impl<T: Buf> Buf for BufList<T> {
5656
}
5757

5858
#[inline]
59-
fn chunks_vectored<'t>(&'t self, dst: &mut [IoSlice<'t>]) -> usize {
59+
fn chunks_vectored<'data>(&'data self, dst: &mut [IoSlice<'data>]) -> usize {
6060
if dst.is_empty() {
6161
return 0;
6262
}

src/ext/informational.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ where
6666
// being either a real reference, or moving the http::Response into the closure,
6767
// in a backwards-compatible change in the future.
6868
#[derive(Debug)]
69-
pub struct Response<'a>(&'a http::Response<()>);
69+
pub struct Response<'resp>(&'resp http::Response<()>);
7070

7171
impl Response<'_> {
7272
#[inline]

src/ext/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ impl Protocol {
113113
}
114114

115115
#[cfg(feature = "http2")]
116-
impl<'a> From<&'a str> for Protocol {
117-
fn from(value: &'a str) -> Self {
116+
impl<'proto> From<&'proto str> for Protocol {
117+
fn from(value: &'proto str) -> Self {
118118
Self {
119119
inner: h2::ext::Protocol::from(value),
120120
}
@@ -165,10 +165,10 @@ impl HeaderCaseMap {
165165
/// Returns a view of all spellings associated with that header name,
166166
/// in the order they were found.
167167
#[cfg(feature = "client")]
168-
pub(crate) fn get_all<'a>(
169-
&'a self,
168+
pub(crate) fn get_all<'hdr>(
169+
&'hdr self,
170170
name: &HeaderName,
171-
) -> impl Iterator<Item = impl AsRef<[u8]> + 'a> + 'a {
171+
) -> impl Iterator<Item = impl AsRef<[u8]> + 'hdr> + 'hdr {
172172
self.get_all_internal(name)
173173
}
174174

src/ffi/task.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ struct TaskFuture {
128128
/// its only purpose is to provide access to the waker. See `hyper_waker`.
129129
///
130130
/// Corresponding Rust type: <https://doc.rust-lang.org/std/task/struct.Context.html>
131-
pub struct hyper_context<'a>(Context<'a>);
131+
pub struct hyper_context<'ctx>(Context<'ctx>);
132132

133133
/// A waker that is saved and used to waken a pending task.
134134
///
@@ -511,7 +511,9 @@ where
511511
// ===== impl hyper_context =====
512512

513513
impl hyper_context<'_> {
514-
pub(crate) fn wrap<'a, 'b>(cx: &'a mut Context<'b>) -> &'a mut hyper_context<'b> {
514+
pub(crate) fn wrap<'borrow, 'ctx>(
515+
cx: &'borrow mut Context<'ctx>,
516+
) -> &'borrow mut hyper_context<'ctx> {
515517
// A struct with only one field has the same layout as that field.
516518
unsafe { std::mem::transmute::<&mut Context<'_>, &mut hyper_context<'_>>(cx) }
517519
}

src/proto/h1/decode.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,12 @@ macro_rules! put_u8 {
286286
};
287287
}
288288

289-
struct StepArgs<'a> {
290-
chunk_size: &'a mut u64,
291-
chunk_buf: &'a mut Option<Bytes>,
292-
extensions_cnt: &'a mut u64,
293-
trailers_buf: &'a mut Option<BytesMut>,
294-
trailers_cnt: &'a mut usize,
289+
struct StepArgs<'args> {
290+
chunk_size: &'args mut u64,
291+
chunk_buf: &'args mut Option<Bytes>,
292+
extensions_cnt: &'args mut u64,
293+
trailers_buf: &'args mut Option<BytesMut>,
294+
trailers_cnt: &'args mut usize,
295295
max_headers_cnt: usize,
296296
max_headers_bytes: usize,
297297
}

src/proto/h1/dispatch.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,10 +509,10 @@ where
509509

510510
/// A drop guard to allow a mutable borrow of an Option while being able to
511511
/// set whether the `Option` should be cleared on drop.
512-
struct OptGuard<'a, T>(Pin<&'a mut Option<T>>, bool);
512+
struct OptGuard<'opt, T>(Pin<&'opt mut Option<T>>, bool);
513513

514-
impl<'a, T> OptGuard<'a, T> {
515-
fn new(pin: Pin<&'a mut Option<T>>) -> Self {
514+
impl<'opt, T> OptGuard<'opt, T> {
515+
fn new(pin: Pin<&'opt mut Option<T>>) -> Self {
516516
OptGuard(pin, false)
517517
}
518518

src/proto/h1/encode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ where
317317
}
318318

319319
#[inline]
320-
fn chunks_vectored<'t>(&'t self, dst: &mut [IoSlice<'t>]) -> usize {
320+
fn chunks_vectored<'data>(&'data self, dst: &mut [IoSlice<'data>]) -> usize {
321321
match &self.kind {
322322
BufKind::Exact(b) => b.chunks_vectored(dst),
323323
BufKind::Limited(b) => b.chunks_vectored(dst),

src/proto/h1/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ impl<B: Buf> Buf for WriteBuf<B> {
637637
}
638638

639639
#[inline]
640-
fn chunks_vectored<'t>(&'t self, dst: &mut [IoSlice<'t>]) -> usize {
640+
fn chunks_vectored<'data>(&'data self, dst: &mut [IoSlice<'data>]) -> usize {
641641
let n = self.headers.chunks_vectored(dst);
642642
self.queue.chunks_vectored(&mut dst[n..]) + n
643643
}

0 commit comments

Comments
 (0)