boulder/draft: Add support for license matching when running boulder new #1571
reviewdog [clippy] report
reported by reviewdog 🐶
Findings (6)
boulder/src/draft/licenses.rs|81 col 45| warning: writing &PathBuf
instead of &Path
involves a new object where a slice will do
--> boulder/src/draft/licenses.rs:81:45
|
81 | pub fn match_licences(dir: &Path, spdx_dir: &PathBuf) -> Result<Vec, Error> {
| ^^^^^^^^ help: change this to: &Path
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: #[warn(clippy::ptr_arg)]
on by default
boulder/src/draft/licenses.rs|85 col 33| warning: useless conversion to the same type: std::collections::hash_set::Intersection<'_, std::path::PathBuf, std::hash::RandomState>
--> boulder/src/draft/licenses.rs:85:33
|
85 | let reuse_matches: Vec<> = dir_entries
| ^
86 | | .intersection(&spdx_pure)
87 | | .into_iter()
| |^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
= note: #[warn(clippy::useless_conversion)]
on by default
help: consider removing .into_iter()
|
85 ~ let reuse_matches: Vec<> = dir_entries
86 + .intersection(&spdx_pure)
|
boulder/src/draft/licenses.rs|88 col 18| warning: to_string()
called on a &str
--> boulder/src/draft/licenses.rs:88:18
|
88 | .map(|m| m.with_extension("").to_str().unwrap_or_default().to_string())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: m.with_extension("").to_str().unwrap_or_default().to_owned()
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#str_to_string
= note: requested on the command line with -W clippy::str-to-string
boulder/src/draft/licenses.rs|105 col 67| warning: the borrowed expression implements the required traits
--> boulder/src/draft/licenses.rs:105:67
|
105 | let license_content: String = std::fs::read_to_string(&license)
| ^^^^^^^^ help: change this to: license
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
= note: #[warn(clippy::needless_borrows_for_generic_args)]
on by default
boulder/src/draft/licenses.rs|120 col 75| warning: the borrowed expression implements the required traits
--> boulder/src/draft/licenses.rs:120:75
|
120 | let truncated_canonical: String = std::fs::read_to_string(&spdx_license)
| ^^^^^^^^^^^^^ help: change this to: spdx_license
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
boulder/src/draft/licenses.rs|144 col 25| warning: to_string()
called on a &str
--> boulder/src/draft/licenses.rs:144:25
|
144 | / spdx_license
145 | | .with_extension("")
146 | | .file_name()
147 | | .unwrap_or_default()
148 | | .to_str()
149 | | .unwrap_or_default()
150 | | .to_string(),
| |___________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#str_to_string
help: try
|
144 ~ spdx_license
145 + .with_extension("")
146 + .file_name()
147 + .unwrap_or_default()
148 + .to_str()
149 ~ .unwrap_or_default().to_owned(),
|
Filtered Findings (0)
Annotations
Check warning on line 81 in boulder/src/draft/licenses.rs
github-actions / clippy
[clippy] boulder/src/draft/licenses.rs#L81
warning: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
--> boulder/src/draft/licenses.rs:81:45
|
81 | pub fn match_licences(dir: &Path, spdx_dir: &PathBuf) -> Result<Vec<String>, Error> {
| ^^^^^^^^ help: change this to: `&Path`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: `#[warn(clippy::ptr_arg)]` on by default
Raw output
boulder/src/draft/licenses.rs:81:45:w:warning: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
--> boulder/src/draft/licenses.rs:81:45
|
81 | pub fn match_licences(dir: &Path, spdx_dir: &PathBuf) -> Result<Vec<String>, Error> {
| ^^^^^^^^ help: change this to: `&Path`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
= note: `#[warn(clippy::ptr_arg)]` on by default
__END__
Check warning on line 85 in boulder/src/draft/licenses.rs
github-actions / clippy
[clippy] boulder/src/draft/licenses.rs#L85
warning: useless conversion to the same type: `std::collections::hash_set::Intersection<'_, std::path::PathBuf, std::hash::RandomState>`
--> boulder/src/draft/licenses.rs:85:33
|
85 | let reuse_matches: Vec<_> = dir_entries
| _________________________________^
86 | | .intersection(&spdx_pure)
87 | | .into_iter()
| |____________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
= note: `#[warn(clippy::useless_conversion)]` on by default
help: consider removing `.into_iter()`
|
85 ~ let reuse_matches: Vec<_> = dir_entries
86 + .intersection(&spdx_pure)
|
Raw output
boulder/src/draft/licenses.rs:85:33:w:warning: useless conversion to the same type: `std::collections::hash_set::Intersection<'_, std::path::PathBuf, std::hash::RandomState>`
--> boulder/src/draft/licenses.rs:85:33
|
85 | let reuse_matches: Vec<_> = dir_entries
| _________________________________^
86 | | .intersection(&spdx_pure)
87 | | .into_iter()
| |____________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
= note: `#[warn(clippy::useless_conversion)]` on by default
help: consider removing `.into_iter()`
|
85 ~ let reuse_matches: Vec<_> = dir_entries
86 + .intersection(&spdx_pure)
|
__END__
Check warning on line 88 in boulder/src/draft/licenses.rs
github-actions / clippy
[clippy] boulder/src/draft/licenses.rs#L88
warning: `to_string()` called on a `&str`
--> boulder/src/draft/licenses.rs:88:18
|
88 | .map(|m| m.with_extension("").to_str().unwrap_or_default().to_string())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `m.with_extension("").to_str().unwrap_or_default().to_owned()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#str_to_string
= note: requested on the command line with `-W clippy::str-to-string`
Raw output
boulder/src/draft/licenses.rs:88:18:w:warning: `to_string()` called on a `&str`
--> boulder/src/draft/licenses.rs:88:18
|
88 | .map(|m| m.with_extension("").to_str().unwrap_or_default().to_string())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `m.with_extension("").to_str().unwrap_or_default().to_owned()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#str_to_string
= note: requested on the command line with `-W clippy::str-to-string`
__END__
Check warning on line 105 in boulder/src/draft/licenses.rs
github-actions / clippy
[clippy] boulder/src/draft/licenses.rs#L105
warning: the borrowed expression implements the required traits
--> boulder/src/draft/licenses.rs:105:67
|
105 | let license_content: String = std::fs::read_to_string(&license)
| ^^^^^^^^ help: change this to: `license`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
= note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default
Raw output
boulder/src/draft/licenses.rs:105:67:w:warning: the borrowed expression implements the required traits
--> boulder/src/draft/licenses.rs:105:67
|
105 | let license_content: String = std::fs::read_to_string(&license)
| ^^^^^^^^ help: change this to: `license`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
= note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default
__END__
Check warning on line 120 in boulder/src/draft/licenses.rs
github-actions / clippy
[clippy] boulder/src/draft/licenses.rs#L120
warning: the borrowed expression implements the required traits
--> boulder/src/draft/licenses.rs:120:75
|
120 | let truncated_canonical: String = std::fs::read_to_string(&spdx_license)
| ^^^^^^^^^^^^^ help: change this to: `spdx_license`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
Raw output
boulder/src/draft/licenses.rs:120:75:w:warning: the borrowed expression implements the required traits
--> boulder/src/draft/licenses.rs:120:75
|
120 | let truncated_canonical: String = std::fs::read_to_string(&spdx_license)
| ^^^^^^^^^^^^^ help: change this to: `spdx_license`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
__END__
Check warning on line 144 in boulder/src/draft/licenses.rs
github-actions / clippy
[clippy] boulder/src/draft/licenses.rs#L144
warning: `to_string()` called on a `&str`
--> boulder/src/draft/licenses.rs:144:25
|
144 | / spdx_license
145 | | .with_extension("")
146 | | .file_name()
147 | | .unwrap_or_default()
148 | | .to_str()
149 | | .unwrap_or_default()
150 | | .to_string(),
| |________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#str_to_string
help: try
|
144 ~ spdx_license
145 + .with_extension("")
146 + .file_name()
147 + .unwrap_or_default()
148 + .to_str()
149 ~ .unwrap_or_default().to_owned(),
|
Raw output
boulder/src/draft/licenses.rs:144:25:w:warning: `to_string()` called on a `&str`
--> boulder/src/draft/licenses.rs:144:25
|
144 | / spdx_license
145 | | .with_extension("")
146 | | .file_name()
147 | | .unwrap_or_default()
148 | | .to_str()
149 | | .unwrap_or_default()
150 | | .to_string(),
| |________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#str_to_string
help: try
|
144 ~ spdx_license
145 + .with_extension("")
146 + .file_name()
147 + .unwrap_or_default()
148 + .to_str()
149 ~ .unwrap_or_default().to_owned(),
|
__END__