Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ panic = "allow"
pattern_type_mismatch = "allow"
redundant_closure_for_method_calls = "allow"
redundant_else = "allow"
single_char_lifetime_names = "allow"
struct_excessive_bools = "allow" # TODO: bogus lint?
trivially_copy_pass_by_ref = "allow"
unnecessary_trailing_comma = "allow"
Expand Down
2 changes: 1 addition & 1 deletion src/client/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ mod tests {
}

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

impl<F, T> Future for PollOnce<'_, F>
where
Expand Down
2 changes: 1 addition & 1 deletion src/common/buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl<T: Buf> Buf for BufList<T> {
}

#[inline]
fn chunks_vectored<'t>(&'t self, dst: &mut [IoSlice<'t>]) -> usize {
fn chunks_vectored<'data>(&'data self, dst: &mut [IoSlice<'data>]) -> usize {
if dst.is_empty() {
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ext/informational.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ where
// being either a real reference, or moving the http::Response into the closure,
// in a backwards-compatible change in the future.
#[derive(Debug)]
pub struct Response<'a>(&'a http::Response<()>);
pub struct Response<'resp>(&'resp http::Response<()>);

impl Response<'_> {
#[inline]
Expand Down
10 changes: 5 additions & 5 deletions src/ext/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ impl Protocol {
}

#[cfg(feature = "http2")]
impl<'a> From<&'a str> for Protocol {
fn from(value: &'a str) -> Self {
impl<'proto> From<&'proto str> for Protocol {
fn from(value: &'proto str) -> Self {
Self {
inner: h2::ext::Protocol::from(value),
}
Expand Down Expand Up @@ -165,10 +165,10 @@ impl HeaderCaseMap {
/// Returns a view of all spellings associated with that header name,
/// in the order they were found.
#[cfg(feature = "client")]
pub(crate) fn get_all<'a>(
&'a self,
pub(crate) fn get_all<'hdr>(
&'hdr self,
name: &HeaderName,
) -> impl Iterator<Item = impl AsRef<[u8]> + 'a> + 'a {
) -> impl Iterator<Item = impl AsRef<[u8]> + 'hdr> + 'hdr {
self.get_all_internal(name)
}

Expand Down
6 changes: 4 additions & 2 deletions src/ffi/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ struct TaskFuture {
/// its only purpose is to provide access to the waker. See `hyper_waker`.
///
/// Corresponding Rust type: <https://doc.rust-lang.org/std/task/struct.Context.html>
pub struct hyper_context<'a>(Context<'a>);
pub struct hyper_context<'ctx>(Context<'ctx>);

/// A waker that is saved and used to waken a pending task.
///
Expand Down Expand Up @@ -511,7 +511,9 @@ where
// ===== impl hyper_context =====

impl hyper_context<'_> {
pub(crate) fn wrap<'a, 'b>(cx: &'a mut Context<'b>) -> &'a mut hyper_context<'b> {
pub(crate) fn wrap<'borrow, 'ctx>(
cx: &'borrow mut Context<'ctx>,
) -> &'borrow mut hyper_context<'ctx> {
// A struct with only one field has the same layout as that field.
unsafe { std::mem::transmute::<&mut Context<'_>, &mut hyper_context<'_>>(cx) }
}
Expand Down
12 changes: 6 additions & 6 deletions src/proto/h1/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,12 @@ macro_rules! put_u8 {
};
}

struct StepArgs<'a> {
chunk_size: &'a mut u64,
chunk_buf: &'a mut Option<Bytes>,
extensions_cnt: &'a mut u64,
trailers_buf: &'a mut Option<BytesMut>,
trailers_cnt: &'a mut usize,
struct StepArgs<'args> {
chunk_size: &'args mut u64,
chunk_buf: &'args mut Option<Bytes>,
extensions_cnt: &'args mut u64,
trailers_buf: &'args mut Option<BytesMut>,
trailers_cnt: &'args mut usize,
max_headers_cnt: usize,
max_headers_bytes: usize,
}
Expand Down
6 changes: 3 additions & 3 deletions src/proto/h1/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,10 +509,10 @@ where

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

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

Expand Down
2 changes: 1 addition & 1 deletion src/proto/h1/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ where
}

#[inline]
fn chunks_vectored<'t>(&'t self, dst: &mut [IoSlice<'t>]) -> usize {
fn chunks_vectored<'data>(&'data self, dst: &mut [IoSlice<'data>]) -> usize {
match &self.kind {
BufKind::Exact(b) => b.chunks_vectored(dst),
BufKind::Limited(b) => b.chunks_vectored(dst),
Expand Down
2 changes: 1 addition & 1 deletion src/proto/h1/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ impl<B: Buf> Buf for WriteBuf<B> {
}

#[inline]
fn chunks_vectored<'t>(&'t self, dst: &mut [IoSlice<'t>]) -> usize {
fn chunks_vectored<'data>(&'data self, dst: &mut [IoSlice<'data>]) -> usize {
let n = self.headers.chunks_vectored(dst);
self.queue.chunks_vectored(&mut dst[n..]) + n
}
Expand Down
14 changes: 7 additions & 7 deletions src/proto/h1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,26 +68,26 @@ pub(crate) struct ParsedMessage<T> {
wants_upgrade: bool,
}

pub(crate) struct ParseContext<'a> {
cached_headers: &'a mut Option<HeaderMap>,
req_method: &'a mut Option<Method>,
pub(crate) struct ParseContext<'ctx> {
cached_headers: &'ctx mut Option<HeaderMap>,
req_method: &'ctx mut Option<Method>,
h1_parser_config: ParserConfig,
h1_max_headers: Option<usize>,
preserve_header_case: bool,
#[cfg(feature = "ffi")]
preserve_header_order: bool,
h09_responses: bool,
#[cfg(feature = "client")]
on_informational: &'a mut Option<crate::ext::OnInformational>,
on_informational: &'ctx mut Option<crate::ext::OnInformational>,
}

/// Passed to `Http1Transaction::encode`.
pub(crate) struct Encode<'a, T> {
head: &'a mut MessageHead<T>,
pub(crate) struct Encode<'encode, T> {
head: &'encode mut MessageHead<T>,
body: Option<BodyLength>,
#[cfg(feature = "server")]
keep_alive: bool,
req_method: &'a mut Option<Method>,
req_method: &'encode mut Option<Method>,
title_case_headers: bool,
#[cfg(feature = "server")]
date_header: bool,
Expand Down
2 changes: 1 addition & 1 deletion src/proto/h1/role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1652,7 +1652,7 @@ fn write_headers_original_case(
}

#[cfg(feature = "client")]
struct FastWrite<'a>(&'a mut Vec<u8>);
struct FastWrite<'data>(&'data mut Vec<u8>);

#[cfg(feature = "client")]
impl fmt::Write for FastWrite<'_> {
Expand Down
2 changes: 1 addition & 1 deletion src/proto/h2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ impl<B: Buf> Buf for SendBuf<B> {
}
}

fn chunks_vectored<'a>(&'a self, dst: &mut [IoSlice<'a>]) -> usize {
fn chunks_vectored<'data>(&'data self, dst: &mut [IoSlice<'data>]) -> usize {
match self {
Self::Buf(b) => b.chunks_vectored(dst),
Self::Cursor(c) => c.chunks_vectored(dst),
Expand Down
8 changes: 4 additions & 4 deletions src/rt/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ pub trait Write {
/// It is undefined behavior to de-initialize any bytes from the uninitialized
/// region, since it is merely unknown whether this region is uninitialized or
/// not, and if part of it turns out to be initialized, it must stay initialized.
pub struct ReadBuf<'a> {
raw: &'a mut [MaybeUninit<u8>],
pub struct ReadBuf<'data> {
raw: &'data mut [MaybeUninit<u8>],
filled: usize,
init: usize,
}
Expand Down Expand Up @@ -227,8 +227,8 @@ pub struct ReadBuf<'a> {
/// assert_eq!(read_buf.filled(), b"hello");
/// ```
#[derive(Debug)]
pub struct ReadBufCursor<'a> {
buf: &'a mut ReadBuf<'a>,
pub struct ReadBufCursor<'buf> {
buf: &'buf mut ReadBuf<'buf>,
}

impl<'data> ReadBuf<'data> {
Expand Down
4 changes: 2 additions & 2 deletions tests/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3542,8 +3542,8 @@ impl Serve {
type BoxError = Box<dyn std::error::Error + Send + Sync>;
type BoxFuture = Pin<Box<dyn Future<Output = Result<Response<ReplyBody>, BoxError>> + Send>>;

struct ReplyBuilder<'a> {
tx: &'a Mutex<spmc::Sender<Reply>>,
struct ReplyBuilder<'mtx> {
tx: &'mtx Mutex<spmc::Sender<Reply>>,
}

impl ReplyBuilder<'_> {
Expand Down
Loading