Make build work (#546)
The mbedtls example has caused problem in the main build a number of times. By making it a standalone `cargo new --bin`, we can keep it in the source tree as a good example but avoid having it break the main build. Also, fix some clippy lints.
This commit is contained in:
@@ -328,7 +328,7 @@ impl Error {
|
||||
}
|
||||
|
||||
/// One of the types of error the can occur when processing a Request.
|
||||
#[derive(Debug, PartialEq, Clone, Copy)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
pub enum ErrorKind {
|
||||
/// The url could not be understood.
|
||||
InvalidUrl,
|
||||
|
||||
@@ -62,7 +62,7 @@ impl fmt::Display for HeaderLine {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq)]
|
||||
#[derive(Clone, PartialEq, Eq)]
|
||||
/// Wrapper type for a header field.
|
||||
/// <https://tools.ietf.org/html/rfc7230#section-3.2>
|
||||
pub struct Header {
|
||||
|
||||
@@ -799,9 +799,9 @@ pub(crate) fn charset_from_content_type(header: Option<&str>) -> &str {
|
||||
header
|
||||
.and_then(|header| {
|
||||
header.find(';').and_then(|semi| {
|
||||
(&header[semi + 1..])
|
||||
header[semi + 1..]
|
||||
.find('=')
|
||||
.map(|equal| (&header[semi + equal + 2..]).trim())
|
||||
.map(|equal| header[semi + equal + 2..].trim())
|
||||
})
|
||||
})
|
||||
.unwrap_or(DEFAULT_CHARACTER_SET)
|
||||
|
||||
@@ -666,7 +666,7 @@ mod tests {
|
||||
let mut deadline_stream = DeadlineStream::new(stream, None);
|
||||
let mut buf = [0u8; 1];
|
||||
for _ in 0..8193 {
|
||||
deadline_stream.read(&mut buf).unwrap();
|
||||
let _ = deadline_stream.read(&mut buf).unwrap();
|
||||
}
|
||||
let reads = reads.lock().unwrap();
|
||||
assert_eq!(reads.len(), 2);
|
||||
|
||||
@@ -80,7 +80,7 @@ fn connection_reuse_with_408() {
|
||||
// pulls from the pool. If for some reason the timed-out
|
||||
// connection wasn't in the pool, we won't be testing what
|
||||
// we thought we were testing.
|
||||
let resp = agent.post(&url).send_string("hello".into()).unwrap();
|
||||
let resp = agent.post(&url).send_string("hello").unwrap();
|
||||
assert_eq!(resp.status(), 200);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ mod timeout;
|
||||
|
||||
type RequestHandler = dyn Fn(&Unit) -> Result<Stream, Error> + Send + 'static;
|
||||
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub(crate) static TEST_HANDLERS: Lazy<Arc<Mutex<HashMap<String, Box<RequestHandler>>>>> =
|
||||
Lazy::new(|| Arc::new(Mutex::new(HashMap::new())));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user