mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-07-26 07:58:14 +00:00
refactor: rework uri_encode to limit allocation
add add some related tests.
catched from clippy lint `format_collect`
message: use of `format!` to build up a string from an iterator
--> src/api/common/encoding.rs:12:17
|
12 | let value = format!("{}", c)
| _____________________________^
13 | | .bytes()
14 | | .map(|b| format!("%{:02X}", b))
15 | | .collect::<String>();
| |________________________________________^
|
help: call `fold` instead
--> src/api/common/encoding.rs:14:7
|
14 | .map(|b| format!("%{:02X}", b))
| ^^^
help: ... and use the `write!` macro here
--> src/api/common/encoding.rs:14:15
|
14 | .map(|b| format!("%{:02X}", b))
| ^^^^^^^^^^^^^^^^^^^^^
= note: this can be written more efficiently by appending to a `String` directly
= help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#format_collect
This commit is contained in:
@@ -183,6 +183,7 @@ strip = "debuginfo"
|
||||
[workspace.lints.clippy]
|
||||
# pedantic lints configuration
|
||||
doc_markdown = "warn"
|
||||
format_collect = "warn"
|
||||
manual_midpoint = "warn"
|
||||
semicolon_if_nothing_returned = "warn"
|
||||
unnecessary_semicolon = "warn"
|
||||
|
||||
Reference in New Issue
Block a user