boulder/draft: Add support for license matching when running boulder new #1571
ci.yaml
on: pull_request
Build & Test Project
1m 51s
Annotations
6 warnings
[clippy] boulder/src/draft/licenses.rs#L81:
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
|
[clippy] boulder/src/draft/licenses.rs#L85:
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)
|
|
[clippy] boulder/src/draft/licenses.rs#L88:
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`
|
[clippy] boulder/src/draft/licenses.rs#L105:
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
|
[clippy] boulder/src/draft/licenses.rs#L120:
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
|
[clippy] boulder/src/draft/licenses.rs#L144:
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(),
|
|