Skip to content

Commit caafc3e

Browse files
committed
Appease the formatting gods
1 parent 9b4c651 commit caafc3e

File tree

10 files changed

+25
-17
lines changed

10 files changed

+25
-17
lines changed

src/ffi/body.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use http_body_util::BodyExt as _;
77
use libc::{c_int, size_t};
88

99
use super::task::{hyper_context, hyper_task, hyper_task_return_type, AsTaskType};
10+
use super::userdata::{hyper_userdata_drop, Userdata};
1011
use super::HYPER_ITER_CONTINUE;
11-
use super::userdata::{Userdata, hyper_userdata_drop};
1212
use crate::body::{Bytes, Frame, Incoming as IncomingBody};
1313

1414
/// A streaming HTTP body.

src/ffi/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
use std::pin::Pin;
12
use std::ptr;
23
use std::sync::Arc;
3-
use std::pin::Pin;
44

55
use libc::c_int;
66

src/ffi/http_types.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use std::ffi::c_void;
55
use super::body::hyper_body;
66
use super::error::hyper_code;
77
use super::task::{hyper_task_return_type, AsTaskType};
8+
use super::userdata::{hyper_userdata_drop, Userdata};
89
use super::HYPER_ITER_CONTINUE;
9-
use super::userdata::{Userdata, hyper_userdata_drop};
1010
use crate::body::Incoming as IncomingBody;
1111
use crate::ext::{HeaderCaseMap, OriginalHeaderOrder, ReasonPhrase};
1212
use crate::header::{HeaderName, HeaderValue};
@@ -574,7 +574,6 @@ impl From<Response<IncomingBody>> for hyper_response {
574574
}
575575
}
576576

577-
578577
unsafe impl AsTaskType for hyper_response {
579578
fn as_task_type(&self) -> hyper_task_return_type {
580579
hyper_task_return_type::HYPER_TASK_RESPONSE

src/ffi/io.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::rt::{Read, Write};
66
use libc::size_t;
77

88
use super::task::hyper_context;
9-
use super::userdata::{Userdata, hyper_userdata_drop};
9+
use super::userdata::{hyper_userdata_drop, Userdata};
1010

1111
/// Sentinel value to return from a read or write callback that the operation
1212
/// is pending.
@@ -153,7 +153,12 @@ impl Read for hyper_io {
153153
let buf_ptr = unsafe { buf.as_mut() }.as_mut_ptr() as *mut u8;
154154
let buf_len = buf.remaining();
155155

156-
match (self.read)(self.userdata.as_ptr(), hyper_context::wrap(cx), buf_ptr, buf_len) {
156+
match (self.read)(
157+
self.userdata.as_ptr(),
158+
hyper_context::wrap(cx),
159+
buf_ptr,
160+
buf_len,
161+
) {
157162
HYPER_IO_PENDING => Poll::Pending,
158163
HYPER_IO_ERROR => Poll::Ready(Err(std::io::Error::new(
159164
std::io::ErrorKind::Other,
@@ -178,7 +183,12 @@ impl Write for hyper_io {
178183
let buf_ptr = buf.as_ptr();
179184
let buf_len = buf.len();
180185

181-
match (self.write)(self.userdata.as_ptr(), hyper_context::wrap(cx), buf_ptr, buf_len) {
186+
match (self.write)(
187+
self.userdata.as_ptr(),
188+
hyper_context::wrap(cx),
189+
buf_ptr,
190+
buf_len,
191+
) {
182192
HYPER_IO_PENDING => Poll::Pending,
183193
HYPER_IO_ERROR => Poll::Ready(Err(std::io::Error::new(
184194
std::io::ErrorKind::Other,

src/ffi/macros.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ macro_rules! non_null {
3737
return $err;
3838
}
3939
#[allow(unused_unsafe)]
40-
unsafe { $eval }
40+
unsafe {
41+
$eval
42+
}
4143
}};
4244
(*$ptr:ident ?= $err:expr) => {{
4345
non_null!($ptr, *$ptr, $err)

src/ffi/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ mod macros;
3939

4040
mod body;
4141
mod client;
42-
mod server;
4342
mod error;
4443
mod http_types;
4544
mod io;
45+
mod server;
4646
mod task;
4747
mod time;
4848
mod userdata;

src/ffi/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::ffi::error::hyper_code;
77
use crate::ffi::http_types::{hyper_request, hyper_response};
88
use crate::ffi::io::hyper_io;
99
use crate::ffi::task::{hyper_executor, hyper_task, WeakExec};
10-
use crate::ffi::userdata::{Userdata, hyper_userdata_drop};
10+
use crate::ffi::userdata::{hyper_userdata_drop, Userdata};
1111
use crate::server::conn::http1;
1212
use crate::server::conn::http2;
1313

src/ffi/task.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use futures_util::stream::{FuturesUnordered, Stream};
1212
use libc::c_int;
1313

1414
use super::error::hyper_code;
15-
use super::userdata::{Userdata, hyper_userdata_drop};
15+
use super::userdata::{hyper_userdata_drop, Userdata};
1616

1717
type BoxFuture<T> = Pin<Box<dyn Future<Output = T> + Send>>;
1818
type BoxAny = Box<dyn AsTaskType + Send + Sync>;

src/ffi/time.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
use std::collections::binary_heap::{BinaryHeap, PeekMut};
12
use std::pin::Pin;
23
use std::sync::{Arc, Mutex};
34
use std::task::{Context, Poll, Waker};
4-
use std::time::{Instant, Duration};
5-
use std::collections::binary_heap::{BinaryHeap, PeekMut};
5+
use std::time::{Duration, Instant};
66

77
/// A heap of timer entries with their associated wakers, backing `TimerFuture` instances.
88
pub(super) struct TimerHeap(BinaryHeap<TimerEntry>);

src/ffi/userdata.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ pub(crate) struct Userdata {
2121

2222
impl Userdata {
2323
pub(crate) fn new(data: *mut c_void, drop: hyper_userdata_drop) -> Self {
24-
Self {
25-
data,
26-
drop,
27-
}
24+
Self { data, drop }
2825
}
2926

3027
pub(crate) fn as_ptr(&self) -> *mut c_void {

0 commit comments

Comments
 (0)