Skip to content

Commit 982e6a5

Browse files
oliviacrainseanmonstar
authored andcommitted
style(client, server): Remove redundant http1, http2 feature gates
Remove feature gates on methods where the parent module is already gated on said Cargo feature. These gates seem to be leftovers from the split of connection builders into per-http-version modules. Since the `client::conn::http1` and `server::conn::http1` modules are gated on the `http1` feature, we can remove `http1` gates within those modules. Likewise for `client::conn::http2`, `server::conn::http2`, and the `http2` feature.
1 parent 28da8a3 commit 982e6a5

File tree

4 files changed

+0
-41
lines changed

4 files changed

+0
-41
lines changed

src/client/conn/http1.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,6 @@ impl Builder {
486486
/// # Panics
487487
///
488488
/// The minimum value allowed is 8192. This method panics if the passed `max` is less than the minimum.
489-
#[cfg(feature = "http1")]
490-
#[cfg_attr(docsrs, doc(cfg(feature = "http1")))]
491489
pub fn http1_max_buf_size(&mut self, max: usize) -> &mut Self {
492490
assert!(
493491
max >= proto::h1::MINIMUM_MAX_BUFFER_SIZE,

src/client/conn/http2.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,6 @@ impl Builder {
278278
/// If not set, hyper will use a default.
279279
///
280280
/// [spec]: https://http2.github.io/http2-spec/#SETTINGS_INITIAL_WINDOW_SIZE
281-
#[cfg(feature = "http2")]
282-
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
283281
pub fn http2_initial_stream_window_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
284282
if let Some(sz) = sz.into() {
285283
self.h2_builder.adaptive_window = false;
@@ -293,8 +291,6 @@ impl Builder {
293291
/// Passing `None` will do nothing.
294292
///
295293
/// If not set, hyper will use a default.
296-
#[cfg(feature = "http2")]
297-
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
298294
pub fn http2_initial_connection_window_size(
299295
&mut self,
300296
sz: impl Into<Option<u32>>,
@@ -311,8 +307,6 @@ impl Builder {
311307
/// Enabling this will override the limits set in
312308
/// `http2_initial_stream_window_size` and
313309
/// `http2_initial_connection_window_size`.
314-
#[cfg(feature = "http2")]
315-
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
316310
pub fn http2_adaptive_window(&mut self, enabled: bool) -> &mut Self {
317311
use proto::h2::SPEC_WINDOW_SIZE;
318312

@@ -329,8 +323,6 @@ impl Builder {
329323
/// Passing `None` will do nothing.
330324
///
331325
/// If not set, hyper will use a default.
332-
#[cfg(feature = "http2")]
333-
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
334326
pub fn http2_max_frame_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
335327
if let Some(sz) = sz.into() {
336328
self.h2_builder.max_frame_size = sz;
@@ -344,8 +336,6 @@ impl Builder {
344336
/// Pass `None` to disable HTTP2 keep-alive.
345337
///
346338
/// Default is currently disabled.
347-
#[cfg(feature = "http2")]
348-
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
349339
pub fn http2_keep_alive_interval(
350340
&mut self,
351341
interval: impl Into<Option<Duration>>,
@@ -360,8 +350,6 @@ impl Builder {
360350
/// be closed. Does nothing if `http2_keep_alive_interval` is disabled.
361351
///
362352
/// Default is 20 seconds.
363-
#[cfg(feature = "http2")]
364-
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
365353
pub fn http2_keep_alive_timeout(&mut self, timeout: Duration) -> &mut Self {
366354
self.h2_builder.keep_alive_timeout = timeout;
367355
self
@@ -375,8 +363,6 @@ impl Builder {
375363
/// disabled.
376364
///
377365
/// Default is `false`.
378-
#[cfg(feature = "http2")]
379-
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
380366
pub fn http2_keep_alive_while_idle(&mut self, enabled: bool) -> &mut Self {
381367
self.h2_builder.keep_alive_while_idle = enabled;
382368
self
@@ -390,8 +376,6 @@ impl Builder {
390376
/// The default value is determined by the `h2` crate.
391377
///
392378
/// [`h2::client::Builder::max_concurrent_reset_streams`]: https://docs.rs/h2/client/struct.Builder.html#method.max_concurrent_reset_streams
393-
#[cfg(feature = "http2")]
394-
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
395379
pub fn http2_max_concurrent_reset_streams(&mut self, max: usize) -> &mut Self {
396380
self.h2_builder.max_concurrent_reset_streams = Some(max);
397381
self
@@ -404,8 +388,6 @@ impl Builder {
404388
/// # Panics
405389
///
406390
/// The value must be no larger than `u32::MAX`.
407-
#[cfg(feature = "http2")]
408-
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
409391
pub fn http2_max_send_buf_size(&mut self, max: usize) -> &mut Self {
410392
assert!(max <= std::u32::MAX as usize);
411393
self.h2_builder.max_send_buffer_size = max;

src/server/conn/http1.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,6 @@ impl Builder {
299299
/// # Panics
300300
///
301301
/// The minimum value allowed is 8192. This method panics if the passed `max` is less than the minimum.
302-
#[cfg(feature = "http1")]
303-
#[cfg_attr(docsrs, doc(cfg(feature = "http1")))]
304302
pub fn max_buf_size(&mut self, max: usize) -> &mut Self {
305303
assert!(
306304
max >= proto::h1::MINIMUM_MAX_BUFFER_SIZE,

src/server/conn/http2.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ impl<E> Builder<E> {
116116
/// If not set, hyper will use a default.
117117
///
118118
/// [spec]: https://http2.github.io/http2-spec/#SETTINGS_INITIAL_WINDOW_SIZE
119-
#[cfg(feature = "http2")]
120-
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
121119
pub fn http2_initial_stream_window_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
122120
if let Some(sz) = sz.into() {
123121
self.h2_builder.adaptive_window = false;
@@ -131,8 +129,6 @@ impl<E> Builder<E> {
131129
/// Passing `None` will do nothing.
132130
///
133131
/// If not set, hyper will use a default.
134-
#[cfg(feature = "http2")]
135-
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
136132
pub fn http2_initial_connection_window_size(
137133
&mut self,
138134
sz: impl Into<Option<u32>>,
@@ -149,8 +145,6 @@ impl<E> Builder<E> {
149145
/// Enabling this will override the limits set in
150146
/// `http2_initial_stream_window_size` and
151147
/// `http2_initial_connection_window_size`.
152-
#[cfg(feature = "http2")]
153-
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
154148
pub fn http2_adaptive_window(&mut self, enabled: bool) -> &mut Self {
155149
use proto::h2::SPEC_WINDOW_SIZE;
156150

@@ -167,8 +161,6 @@ impl<E> Builder<E> {
167161
/// Passing `None` will do nothing.
168162
///
169163
/// If not set, hyper will use a default.
170-
#[cfg(feature = "http2")]
171-
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
172164
pub fn http2_max_frame_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
173165
if let Some(sz) = sz.into() {
174166
self.h2_builder.max_frame_size = sz;
@@ -182,8 +174,6 @@ impl<E> Builder<E> {
182174
/// Default is no limit (`std::u32::MAX`). Passing `None` will do nothing.
183175
///
184176
/// [spec]: https://http2.github.io/http2-spec/#SETTINGS_MAX_CONCURRENT_STREAMS
185-
#[cfg(feature = "http2")]
186-
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
187177
pub fn http2_max_concurrent_streams(&mut self, max: impl Into<Option<u32>>) -> &mut Self {
188178
self.h2_builder.max_concurrent_streams = max.into();
189179
self
@@ -198,8 +188,6 @@ impl<E> Builder<E> {
198188
///
199189
/// # Cargo Feature
200190
///
201-
#[cfg(feature = "http2")]
202-
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
203191
pub fn http2_keep_alive_interval(
204192
&mut self,
205193
interval: impl Into<Option<Duration>>,
@@ -217,8 +205,6 @@ impl<E> Builder<E> {
217205
///
218206
/// # Cargo Feature
219207
///
220-
#[cfg(feature = "http2")]
221-
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
222208
pub fn http2_keep_alive_timeout(&mut self, timeout: Duration) -> &mut Self {
223209
self.h2_builder.keep_alive_timeout = timeout;
224210
self
@@ -231,8 +217,6 @@ impl<E> Builder<E> {
231217
/// # Panics
232218
///
233219
/// The value must be no larger than `u32::MAX`.
234-
#[cfg(feature = "http2")]
235-
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
236220
pub fn http2_max_send_buf_size(&mut self, max: usize) -> &mut Self {
237221
assert!(max <= std::u32::MAX as usize);
238222
self.h2_builder.max_send_buffer_size = max;
@@ -242,7 +226,6 @@ impl<E> Builder<E> {
242226
/// Enables the [extended CONNECT protocol].
243227
///
244228
/// [extended CONNECT protocol]: https://datatracker.ietf.org/doc/html/rfc8441#section-4
245-
#[cfg(feature = "http2")]
246229
pub fn http2_enable_connect_protocol(&mut self) -> &mut Self {
247230
self.h2_builder.enable_connect_protocol = true;
248231
self
@@ -251,8 +234,6 @@ impl<E> Builder<E> {
251234
/// Sets the max size of received header frames.
252235
///
253236
/// Default is currently ~16MB, but may change.
254-
#[cfg(feature = "http2")]
255-
#[cfg_attr(docsrs, doc(cfg(feature = "http2")))]
256237
pub fn http2_max_header_list_size(&mut self, max: u32) -> &mut Self {
257238
self.h2_builder.max_header_list_size = max;
258239
self

0 commit comments

Comments
 (0)