Skip to main content

Lint clippy::manual_string_new

warning clippy::manual_string_new §

empty String is being created manually

src/render/search.rs:173:22

Clippy · Category: pedantic · cargo-clippy-html

Official Clippy documentation

Targets (1)
  • cargo-clippy-html (bin)

Primary: src/render/search.rs:173:22

            context: "".into(),

help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.100.0/index.html#manual_string_new

note: `-W clippy::manual-string-new` implied by `-W clippy::pedantic`

help: to override `-W clippy::pedantic` add `#[allow(clippy::manual_string_new)]`

help: consider using

Suggestion: consider using

MachineApplicable

--- "a/src/render/search.rs"
+++ "b/src/render/search.rs"
@@ -170,7 +170,7 @@
         let encoded = script(&[Entry {
             kind: "finding".into(),
             name: text.into(),
-            context: "".into(),
+            context: String::new(),
             description: "".into(),
             href: "index.html".into(),
         }])
Rendered diagnostic (text)
warning: empty String is being created manually
   --> src/render/search.rs:173:22
    |
173 |             context: "".into(),
    |                      ^^^^^^^^^ help: consider using: `String::new()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.100.0/index.html#manual_string_new
    = note: `-W clippy::manual-string-new` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::manual_string_new)]`

warning clippy::manual_string_new §

empty String is being created manually

src/render/search.rs:174:26

Clippy · Category: pedantic · cargo-clippy-html

Official Clippy documentation

Targets (1)
  • cargo-clippy-html (bin)

Primary: src/render/search.rs:174:26

            description: "".into(),

help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.100.0/index.html#manual_string_new

help: consider using

Suggestion: consider using

MachineApplicable

--- "a/src/render/search.rs"
+++ "b/src/render/search.rs"
@@ -171,7 +171,7 @@
             kind: "finding".into(),
             name: text.into(),
             context: "".into(),
-            description: "".into(),
+            description: String::new(),
             href: "index.html".into(),
         }])
         .unwrap();
Rendered diagnostic (text)
warning: empty String is being created manually
   --> src/render/search.rs:174:26
    |
174 |             description: "".into(),
    |                          ^^^^^^^^^ help: consider using: `String::new()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.100.0/index.html#manual_string_new