Skip to content

Merge branch 'master' of github.com:mantono/fire into feat/interactive #76

Merge branch 'master' of github.com:mantono/fire into feat/interactive

Merge branch 'master' of github.com:mantono/fire into feat/interactive #76

Triggered via push January 18, 2024 21:26
Status Success
Total duration 6m 46s
Artifacts

rust.yml

on: push
Matrix: build
Fit to window
Zoom out
Zoom in

Annotations

10 warnings
lint
Unexpected input(s) 'token', valid inputs are ['toolchain', 'args', 'use-cross', 'working-directory']
unused import: `handlebars::RenderError`: src/template.rs#L1
warning: unused import: `handlebars::RenderError` --> src/template.rs:1:5 | 1 | use handlebars::RenderError; | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default
unused import: `termcolor::ColorChoice`: src/template.rs#L5
warning: unused import: `termcolor::ColorChoice` --> src/template.rs:5:5 | 5 | use termcolor::ColorChoice; | ^^^^^^^^^^^^^^^^^^^^^^
this `else { if .. }` block can be collapsed: src/template.rs#L38
warning: this `else { if .. }` block can be collapsed --> src/template.rs:38:12 | 38 | } else { | ____________^ 39 | | if interactive { 40 | | let mut added: HashMap<String, String> = HashMap::with_capacity(diff.len()); 41 | | let theme = dialoguer::theme::ColorfulTheme::default(); ... | 57 | | } 58 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_else_if = note: `#[warn(clippy::collapsible_else_if)]` on by default help: collapse nested if block | 38 ~ } else if interactive { 39 + let mut added: HashMap<String, String> = HashMap::with_capacity(diff.len()); 40 + let theme = dialoguer::theme::ColorfulTheme::default(); 41 + let mut input = if use_colors { 42 + dialoguer::Input::with_theme(&theme) 43 + } else { 44 + dialoguer::Input::new() 45 + }; 46 + for key in diff { 47 + let value: String = 48 + input.with_prompt(key.clone()).allow_empty(false).interact_text().unwrap(); 49 + added.insert(key, value); 50 + } 51 + let all = vars.into_iter().chain(added).collect(); 52 + Ok(all) 53 + } else { 54 + let missing: String = diff.into_iter().next().unwrap(); 55 + Err(SubstitutionError::MissingValue(missing)) 56 + } |
you are using an explicit closure for cloning elements: src/template.rs#L30
warning: you are using an explicit closure for cloning elements --> src/template.rs:30:33 | 30 | let diff: HashSet<String> = keys | _________________________________^ 31 | | .difference(&vars.clone().into_keys().collect()) 32 | | .into_iter() 33 | | .map(|x| x.clone()) | |___________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone = note: `#[warn(clippy::map_clone)]` on by default help: consider calling the dedicated `cloned` method | 30 ~ let diff: HashSet<String> = keys 31 + .difference(&vars.clone().into_keys().collect()) 32 + .into_iter().cloned() |
useless conversion to the same type: `std::collections::hash_set::Difference<'_, std::string::String, std::collections::hash_map::RandomState>`: src/template.rs#L30
warning: useless conversion to the same type: `std::collections::hash_set::Difference<'_, std::string::String, std::collections::hash_map::RandomState>` --> src/template.rs:30:33 | 30 | let diff: HashSet<String> = keys | _________________________________^ 31 | | .difference(&vars.clone().into_keys().collect()) 32 | | .into_iter() | |____________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion help: consider removing `.into_iter()` | 30 ~ let diff: HashSet<String> = keys 31 + .difference(&vars.clone().into_keys().collect()) |
variant `NotAFile` is never constructed: src/error.rs#L16
warning: variant `NotAFile` is never constructed --> src/error.rs:16:5 | 11 | pub enum FireError { | --------- variant in this enum ... 16 | NotAFile(PathBuf), | ^^^^^^^^ | = note: `#[warn(dead_code)]` on by default
useless use of `format!`: src/error.rs#L38
warning: useless use of `format!` --> src/error.rs:38:45 | 38 | FireError::TemplateRendering => format!("Unable to render request from template"), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"Unable to render request from template".to_string()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format = note: `#[warn(clippy::useless_format)]` on by default
function `writeln_color` is never used: src/io.rs#L19
warning: function `writeln_color` is never used --> src/io.rs:19:8 | 19 | pub fn writeln_color(stream: &mut StandardStream, content: &str, color: Option<Color>) { | ^^^^^^^^^^^^^
function `write_spec` is never used: src/io.rs#L24
warning: function `write_spec` is never used --> src/io.rs:24:8 | 24 | pub fn write_spec(stream: &mut StandardStream, content: &str, spec: &ColorSpec) { | ^^^^^^^^^^