From 4b9cfe2b672d6a3e156e200cec666321b91068be Mon Sep 17 00:00:00 2001 From: Martin Algesten Date: Tue, 7 Jan 2020 07:55:03 +0100 Subject: [PATCH] fix clippy lints --- src/lib.rs | 26 +++++++++++--------------- src/request.rs | 5 ----- src/unit.rs | 2 +- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index fbf58ce..de74438 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,22 +8,18 @@ //! //! ``` //! // requires feature: `ureq = { version = "*", features = ["json"] }` -//! #[macro_use] -//! extern crate ureq; +//! use ureq::json; +//! // sync post request of some json. +//! let resp = ureq::post("https://myapi.acme.com/ingest") +//! .set("X-My-Header", "Secret") +//! .send_json(json!({ +//! "name": "martin", +//! "rust": true +//! })); //! -//! fn main() { -//! // sync post request of some json. -//! let resp = ureq::post("https://myapi.acme.com/ingest") -//! .set("X-My-Header", "Secret") -//! .send_json(json!({ -//! "name": "martin", -//! "rust": true -//! })); -//! -//! // .ok() tells if response is 200-299. -//! if resp.ok() { -//! // .... -//! } +//! // .ok() tells if response is 200-299. +//! if resp.ok() { +//! // .... //! } //! ``` //! diff --git a/src/request.rs b/src/request.rs index d51b8ce..0e4bb6a 100644 --- a/src/request.rs +++ b/src/request.rs @@ -140,15 +140,10 @@ impl Request { /// The `Content-Length` header is implicitly set to the length of the serialized value. /// /// ``` - /// #[macro_use] - /// extern crate ureq; - /// - /// fn main() { /// let body = b"Hello world!"; /// let r = ureq::post("/my_page") /// .send_bytes(body); /// println!("{:?}", r); - /// } /// ``` pub fn send_bytes(&mut self, data: &[u8]) -> Response { self.do_call(Payload::Bytes(data.to_owned())) diff --git a/src/unit.rs b/src/unit.rs index 4f8a1b8..f652520 100644 --- a/src/unit.rs +++ b/src/unit.rs @@ -338,7 +338,7 @@ fn save_cookies(unit: &Unit, resp: &Response) { if let Some(add_jar) = state.as_mut().map(|state| &mut state.jar) { for raw_cookie in cookies.iter() { let to_parse = if raw_cookie.to_lowercase().contains("domain=") { - raw_cookie.to_string() + (*raw_cookie).to_string() } else { let host = &unit.url.host_str().unwrap_or(DEFAULT_HOST).to_string(); format!("{}; Domain={}", raw_cookie, host)