Skip to content

Commit 2192cab

Browse files
Fix clippy linter issue
* Use `write!` instead of `s += &format!` Signed-off-by: Florentin Dubois <[email protected]>
1 parent 05c2338 commit 2192cab

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/client/proxy.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! with proxy capabilities
55
66
use std::{
7-
fmt::{self, Debug, Display, Formatter},
7+
fmt::{self, Debug, Display, Formatter, Write},
88
marker::PhantomData,
99
net::IpAddr,
1010
str::FromStr,
@@ -40,6 +40,8 @@ pub enum Error {
4040
ParseDirect(String),
4141
#[error("failed to parse '{0}' as url, {1}")]
4242
ParseUrl(String, url::ParseError),
43+
#[error("failed to format query params in url, {0}")]
44+
FormatUrl(fmt::Error),
4345
}
4446

4547
// -----------------------------------------------------------------------------
@@ -262,7 +264,7 @@ impl ProxyBuilder {
262264

263265
let mut p_and_q = url.path().to_string();
264266
if let Some(q) = url.query() {
265-
p_and_q += &format!("?{}", q);
267+
write!(p_and_q, "?{}", q).map_err(Error::FormatUrl)?;
266268
}
267269

268270
let uri = Uri::builder()

0 commit comments

Comments
 (0)