Skip to main content

Lint clippy::ignored_unit_patterns

warning clippy::ignored_unit_patterns §

matching over `()` is more explicit

src/main.rs:95:23

Clippy · Category: pedantic · cargo-clippy-html

Official Clippy documentation

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

Primary: src/main.rs:95:23

            .map_err(|_| "Cannot form report file URL")?;

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

help: use `()` instead of `_`

Suggestion: use `()` instead of `_`

MachineApplicable

--- "a/src/main.rs"
+++ "b/src/main.rs"
@@ -92,7 +92,7 @@
     }
     if opts.open {
         let url = url::Url::from_file_path(&published.index)
-            .map_err(|_| "Cannot form report file URL")?;
+            .map_err(|()| "Cannot form report file URL")?;
         if let Err(e) = webbrowser::open(url.as_str()) {
             eprintln!("Warning: report generated, browser could not open it: {e}");
         }
Rendered diagnostic (text)
warning: matching over `()` is more explicit
  --> src/main.rs:95:23
   |
95 |             .map_err(|_| "Cannot form report file URL")?;
   |                       ^ help: use `()` instead of `_`: `()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.100.0/index.html#ignored_unit_patterns

warning clippy::ignored_unit_patterns §

matching over `()` is more explicit

src/metadata.rs:180:59

Clippy · Category: pedantic · cargo-clippy-html

Official Clippy documentation

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

Primary: src/metadata.rs:180:59

            url::Url::from_directory_path(&root).map_err(|_| "Invalid metadata report root")?;

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

note: `-W clippy::ignored-unit-patterns` implied by `-W clippy::pedantic`

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

help: use `()` instead of `_`

Suggestion: use `()` instead of `_`

MachineApplicable

--- "a/src/metadata.rs"
+++ "b/src/metadata.rs"
@@ -177,7 +177,7 @@
     pub fn validate(&self, root: &Path) -> Result<(), String> {
         let root = root.canonicalize().map_err(|e| e.to_string())?;
         let base =
-            url::Url::from_directory_path(&root).map_err(|_| "Invalid metadata report root")?;
+            url::Url::from_directory_path(&root).map_err(|()| "Invalid metadata report root")?;
         let mut anchors = BTreeMap::new();
         let id_selector = scraper::Selector::parse("[id]").unwrap();
         let hrefs = self
Rendered diagnostic (text)
warning: matching over `()` is more explicit
   --> src/metadata.rs:180:59
    |
180 |             url::Url::from_directory_path(&root).map_err(|_| "Invalid metadata report root")?;
    |                                                           ^ help: use `()` instead of `_`: `()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.100.0/index.html#ignored_unit_patterns
    = note: `-W clippy::ignored-unit-patterns` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::ignored_unit_patterns)]`

warning clippy::ignored_unit_patterns §

matching over `()` is more explicit

src/metadata.rs:194:27

Clippy · Category: pedantic · cargo-clippy-html

Official Clippy documentation

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

Primary: src/metadata.rs:194:27

                .map_err(|_| "Nonlocal metadata URL")?

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

help: use `()` instead of `_`

Suggestion: use `()` instead of `_`

MachineApplicable

--- "a/src/metadata.rs"
+++ "b/src/metadata.rs"
@@ -191,7 +191,7 @@
             let linked = base.join(href).map_err(|e| e.to_string())?;
             let path = linked
                 .to_file_path()
-                .map_err(|_| "Nonlocal metadata URL")?
+                .map_err(|()| "Nonlocal metadata URL")?
                 .canonicalize()
                 .map_err(|e| format!("Broken metadata URL {href}: {e}"))?;
             if !path.starts_with(&root) || !path.is_file() {
Rendered diagnostic (text)
warning: matching over `()` is more explicit
   --> src/metadata.rs:194:27
    |
194 |                 .map_err(|_| "Nonlocal metadata URL")?
    |                           ^ help: use `()` instead of `_`: `()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.100.0/index.html#ignored_unit_patterns

warning clippy::ignored_unit_patterns §

matching over `()` is more explicit

src/render/assets.rs:180:57

Clippy · Category: pedantic · cargo-clippy-html

Official Clippy documentation

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

Primary: src/render/assets.rs:180:57

    let base = url::Url::from_file_path(&path).map_err(|_| "Invalid font CSS URL")?;

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

help: use `()` instead of `_`

Suggestion: use `()` instead of `_`

MachineApplicable

--- "a/src/render/assets.rs"
+++ "b/src/render/assets.rs"
@@ -177,7 +177,7 @@
         Err(error) if error.kind() == std::io::ErrorKind::NotFound => return Ok(()),
         Err(error) => return Err(error.to_string()),
     };
-    let base = url::Url::from_file_path(&path).map_err(|_| "Invalid font CSS URL")?;
+    let base = url::Url::from_file_path(&path).map_err(|()| "Invalid font CSS URL")?;
     // This is the fixed, generator-owned stylesheet, not an arbitrary CSS parser.
     for reference in css.split("url(").skip(1) {
         let (value, _) = reference.split_once(')').ok_or("Unclosed font URL")?;
Rendered diagnostic (text)
warning: matching over `()` is more explicit
   --> src/render/assets.rs:180:57
    |
180 |     let base = url::Url::from_file_path(&path).map_err(|_| "Invalid font CSS URL")?;
    |                                                         ^ help: use `()` instead of `_`: `()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.100.0/index.html#ignored_unit_patterns

warning clippy::ignored_unit_patterns §

matching over `()` is more explicit

src/render/assets.rs:188:23

Clippy · Category: pedantic · cargo-clippy-html

Official Clippy documentation

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

Primary: src/render/assets.rs:188:23

            .map_err(|_| "Nonlocal font resource")?

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

help: use `()` instead of `_`

Suggestion: use `()` instead of `_`

MachineApplicable

--- "a/src/render/assets.rs"
+++ "b/src/render/assets.rs"
@@ -185,7 +185,7 @@
         let linked = base.join(value).map_err(|e| e.to_string())?;
         let target = linked
             .to_file_path()
-            .map_err(|_| "Nonlocal font resource")?
+            .map_err(|()| "Nonlocal font resource")?
             .canonicalize()
             .map_err(|e| format!("Missing font resource {value}: {e}"))?;
         if !target.starts_with(root)
Rendered diagnostic (text)
warning: matching over `()` is more explicit
   --> src/render/assets.rs:188:23
    |
188 |             .map_err(|_| "Nonlocal font resource")?
    |                       ^ help: use `()` instead of `_`: `()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.100.0/index.html#ignored_unit_patterns

warning clippy::ignored_unit_patterns §

matching over `()` is more explicit

src/render/pages.rs:912:60

Clippy · Category: pedantic · cargo-clippy-html

Official Clippy documentation

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

Primary: src/render/pages.rs:912:60

        let base = url::Url::from_file_path(path).map_err(|_| "Invalid report URL")?;

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

help: use `()` instead of `_`

Suggestion: use `()` instead of `_`

MachineApplicable

--- "a/src/render/pages.rs"
+++ "b/src/render/pages.rs"
@@ -909,7 +909,7 @@
         return Err("Missing report index".into());
     }
     for (path, html) in &docs {
-        let base = url::Url::from_file_path(path).map_err(|_| "Invalid report URL")?;
+        let base = url::Url::from_file_path(path).map_err(|()| "Invalid report URL")?;
         let search_hrefs = if path == &root.join("index.html") {
             super::search::read_hrefs(&root)?
         } else {
Rendered diagnostic (text)
warning: matching over `()` is more explicit
   --> src/render/pages.rs:912:60
    |
912 |         let base = url::Url::from_file_path(path).map_err(|_| "Invalid report URL")?;
    |                                                            ^ help: use `()` instead of `_`: `()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.100.0/index.html#ignored_unit_patterns

warning clippy::ignored_unit_patterns §

matching over `()` is more explicit

src/render/pages.rs:930:27

Clippy · Category: pedantic · cargo-clippy-html

Official Clippy documentation

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

Primary: src/render/pages.rs:930:27

                .map_err(|_| "Nonlocal internal link")?

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

help: use `()` instead of `_`

Suggestion: use `()` instead of `_`

MachineApplicable

--- "a/src/render/pages.rs"
+++ "b/src/render/pages.rs"
@@ -927,7 +927,7 @@
             let linked = base.join(href).map_err(|e| e.to_string())?;
             let target = linked
                 .to_file_path()
-                .map_err(|_| "Nonlocal internal link")?
+                .map_err(|()| "Nonlocal internal link")?
                 .canonicalize()
                 .map_err(|e| format!("Broken report link {href}: {e}"))?;
             if !target.starts_with(&root) || !target.is_file() {
Rendered diagnostic (text)
warning: matching over `()` is more explicit
   --> src/render/pages.rs:930:27
    |
930 |                 .map_err(|_| "Nonlocal internal link")?
    |                           ^ help: use `()` instead of `_`: `()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.100.0/index.html#ignored_unit_patterns