hyperium / hyper

An HTTP library for Rust
https://hyper.rs
MIT License
14.07k stars 1.55k forks source link

remove 'static lifetime bound on http1/2 client IO #3667

Open jgraef opened 1 month ago

jgraef commented 1 month ago

The method hyper::client::conn::http1::Builder::handshake has a 'static lifetime bound on the type parameter T (the underlying connection). This lifetime bound is not necessary and prohibits users of the library to borrowing connections to a hyper client.

There are similar bounds on the Connection struct, handshake method, plus all those for http2.

This PR removes these 'static lifetime bounds.

jgraef commented 1 month ago

There's at least one 'static that I missed1. I will update this PR soon.

There are also some Unpin trait bounds that are not necessary. Should I open a new PR for them?

dswij commented 1 month ago

Probably related: https://github.com/hyperium/hyper/pull/3595

I don't see any problem with this, unless I'm missing something? @seanmonstar

jgraef commented 1 month ago

Should I update this PR with that one more 'static bound removed? I can also bring it up-to-date with master. Do you prefer rebase or merge?

seanmonstar commented 1 month ago

Rebase or new commits, whichever you find easier to push. We can always squash when merging.

seanmonstar commented 1 day ago

Seems like rustfmt isn't happy. Could you run rustfmt --check --edition 2021 $(git ls-files '*.rs')?