Skip to content

Commit 657e714

Browse files
committed
cargo fmt
1 parent ea22d43 commit 657e714

File tree

4 files changed

+25
-13
lines changed

4 files changed

+25
-13
lines changed

src/headers/mod.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
33
use async_std::io;
44

5-
use std::convert::TryInto;
65
use std::collections::HashMap;
6+
use std::convert::TryInto;
77
use std::iter::IntoIterator;
88

99
mod constants;
@@ -48,7 +48,9 @@ impl Headers {
4848
name: impl TryInto<HeaderName>,
4949
values: impl ToHeaderValues,
5050
) -> io::Result<Option<Vec<HeaderValue>>> {
51-
let name = name.try_into().map_err(|_| io::Error::new(io::ErrorKind::Other, "Could not convert into header name"))?;
51+
let name = name.try_into().map_err(|_| {
52+
io::Error::new(io::ErrorKind::Other, "Could not convert into header name")
53+
})?;
5254
let values: Vec<HeaderValue> = values.to_header_values()?.collect();
5355
Ok(self.headers.insert(name, values))
5456
}
@@ -57,8 +59,14 @@ impl Headers {
5759
///
5860
/// Unlike `insert` this function will not override the contents of a header, but insert a
5961
/// header if there aren't any. Or else append to the existing list of headers.
60-
pub fn append(&mut self, name: impl TryInto<HeaderName>, values: impl ToHeaderValues) -> io::Result<()> {
61-
let name = name.try_into().map_err(|_| io::Error::new(io::ErrorKind::Other, "Could not convert into header name"))?;
62+
pub fn append(
63+
&mut self,
64+
name: impl TryInto<HeaderName>,
65+
values: impl ToHeaderValues,
66+
) -> io::Result<()> {
67+
let name = name.try_into().map_err(|_| {
68+
io::Error::new(io::ErrorKind::Other, "Could not convert into header name")
69+
})?;
6270
match self.get_mut(&name) {
6371
Some(headers) => {
6472
let mut values: Vec<HeaderValue> = values.to_header_values()?.collect();

src/request.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use async_std::io::{self, BufRead, Read};
22
use async_std::sync;
33

4+
use std::convert::TryInto;
45
use std::mem;
56
use std::pin::Pin;
67
use std::task::{Context, Poll};
7-
use std::convert::TryInto;
88

99
use crate::headers::{
1010
self, HeaderName, HeaderValue, Headers, Names, ToHeaderValues, Values, CONTENT_TYPE,
@@ -213,7 +213,7 @@ impl Request {
213213
}
214214

215215
/// Set an HTTP header.
216-
///
216+
///
217217
/// # Examples
218218
///
219219
/// ```
@@ -238,7 +238,7 @@ impl Request {
238238
///
239239
/// Unlike `insert` this function will not override the contents of a header, but insert a
240240
/// header if there aren't any. Or else append to the existing list of headers.
241-
///
241+
///
242242
/// # Examples
243243
///
244244
/// ```

src/response.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use async_std::io::{self, BufRead, Read};
22
use async_std::sync;
33

4+
use std::convert::TryInto;
45
use std::mem;
56
use std::pin::Pin;
67
use std::task::{Context, Poll};
7-
use std::convert::TryInto;
88

99
use crate::headers::{
1010
self, HeaderName, HeaderValue, Headers, Names, ToHeaderValues, Values, CONTENT_TYPE,
@@ -75,7 +75,7 @@ impl Response {
7575
}
7676

7777
/// Set an HTTP header.
78-
///
78+
///
7979
/// # Examples
8080
///
8181
/// ```
@@ -100,7 +100,7 @@ impl Response {
100100
///
101101
/// Unlike `insert` this function will not override the contents of a header, but insert a
102102
/// header if there aren't any. Or else append to the existing list of headers.
103-
///
103+
///
104104
/// # Examples
105105
///
106106
/// ```

src/trailers.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl Trailers {
7070
}
7171

7272
/// Insert a header into the headers.
73-
///
73+
///
7474
/// # Examples
7575
///
7676
/// ```
@@ -95,7 +95,7 @@ impl Trailers {
9595
///
9696
/// Unlike `insert` this function will not override the contents of a header, but insert a
9797
/// header if there aren't any. Or else append to the existing list of headers.
98-
///
98+
///
9999
/// # Examples
100100
///
101101
/// ```
@@ -108,7 +108,11 @@ impl Trailers {
108108
/// #
109109
/// # Ok(()) }
110110
/// ```
111-
pub fn append(&mut self, name: impl TryInto<HeaderName>, values: impl ToHeaderValues) -> io::Result<()> {
111+
pub fn append(
112+
&mut self,
113+
name: impl TryInto<HeaderName>,
114+
values: impl ToHeaderValues,
115+
) -> io::Result<()> {
112116
self.headers.append(name, values)
113117
}
114118

0 commit comments

Comments
 (0)