Skip to content

Commit

Permalink
fix: fix warnings from clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
tamada committed May 31, 2022
1 parent 12d4c4a commit e6e1aac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/btmeister.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use serde::{Deserialize, Serialize};
use std::fs::OpenOptions;
use std::io::BufReader;
use std::ops::Deref;
use std::path::PathBuf;
use rust_embed::RustEmbed;

Expand Down
16 changes: 8 additions & 8 deletions src/formatter.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
use std::io::{Write, BufWriter};
use std::path::PathBuf;
use std::io::Write;
use std::path::Path;

use super::btmeister::{BuildToolDef, BuildToolDefs};
use super::{BuildTool, Format};

pub trait Formatter {
fn print(&self, out: &mut Box<dyn Write>, base: &PathBuf, vector: Vec<BuildTool>) -> i32 {
fn print(&self, out: &mut Box<dyn Write>, base: &Path, vector: Vec<BuildTool>) -> i32 {
self.print_header(out, base);
vector.iter().enumerate()
.for_each(|item| self.print_each(out, item.1, item.0 == 0));
self.print_footer(out);
0
}
fn print_each(&self, out: &mut Box<dyn Write>, result: &BuildTool, first: bool);
fn print_header(&self, _out: &mut Box<dyn Write>, _base: &PathBuf) {
fn print_header(&self, _out: &mut Box<dyn Write>, _base: &Path) {
}
fn print_footer(&self, _out: &mut Box<dyn Write>) {
}
Expand Down Expand Up @@ -55,7 +55,7 @@ pub struct YamlFormatter{
}

impl Formatter for DefaultFormatter {
fn print_header(&self, out: &mut Box<dyn Write>, base: &PathBuf) {
fn print_header(&self, out: &mut Box<dyn Write>, base: &Path) {
writeln!(out, "{}", base.display()).unwrap();
}

Expand All @@ -75,7 +75,7 @@ impl Formatter for JsonFormatter{
write!(out, "{{\"file-path\":\"{}\",\"tool-name\":\"{}\"}}",
result.path.display(), result.def.name).unwrap();
}
fn print_header(&self, out: &mut Box<dyn Write>, base: &PathBuf) {
fn print_header(&self, out: &mut Box<dyn Write>, base: &Path) {
write!(out, "{{\"base\":\"{}\",\"build-tools\":[", base.display()).unwrap();
}
fn print_footer(&self, out: &mut Box<dyn Write>) {
Expand Down Expand Up @@ -103,7 +103,7 @@ impl Formatter for JsonFormatter{
}

impl Formatter for XmlFormatter{
fn print_header(&self, out: &mut Box<dyn Write>, base: &PathBuf) {
fn print_header(&self, out: &mut Box<dyn Write>, base: &Path) {
writeln!(out, "<?xml version=\"1.0\"?>").unwrap();
write!(out, "<build-tools><base>{}</base>", base.display()).unwrap();
}
Expand Down Expand Up @@ -131,7 +131,7 @@ impl Formatter for XmlFormatter{
}

impl Formatter for YamlFormatter{
fn print_header(&self, out: &mut Box<dyn Write>, base: &PathBuf) {
fn print_header(&self, out: &mut Box<dyn Write>, base: &Path) {
writeln!(out, "base: {}", base.display()).unwrap();
}
fn print_each(&self, out: &mut Box<dyn Write>, result: &BuildTool, _first: bool) {
Expand Down

0 comments on commit e6e1aac

Please sign in to comment.