Skip to content

Commit

Permalink
refactor: fix clippy warnings (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
nozaq authored Feb 10, 2023
1 parent 123b8f5 commit dbfd757
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
20 changes: 11 additions & 9 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"name": "Rust",
"image": "mcr.microsoft.com/devcontainers/rust:1-bullseye",
"customizations": {
"vscode": {
"extensions": [
"EditorConfig.EditorConfig"
],
"settings": {}
"name": "Rust",
"image": "mcr.microsoft.com/devcontainers/rust:bullseye",
"customizations": {
"vscode": {
"extensions": [
"EditorConfig.EditorConfig"
],
"settings": {
"rust-analyzer.checkOnSave.command": "clippy"
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/process/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl<W: Write> GuiCommandWriter<W> {
}

pub fn send(&mut self, command: &GuiCommand) -> Result<(), Error> {
let s = format!("{}\n", command);
let s = format!("{command}\n");
self.writer.write_all(s.as_bytes())?;
self.writer.flush()?;

Expand Down
4 changes: 2 additions & 2 deletions src/protocol/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ mod tests {
];

for (i, c) in ok_cases.iter().enumerate() {
assert!(EngineCommand::parse(c).is_ok(), "failed at #{}", i);
assert!(EngineCommand::parse(c).is_ok(), "failed at #{i}");
}

for (i, c) in ng_cases.iter().enumerate() {
assert!(EngineCommand::parse(c).is_err(), "failed at #{}", i);
assert!(EngineCommand::parse(c).is_err(), "failed at #{i}");
}
}
}
10 changes: 5 additions & 5 deletions src/protocol/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ pub enum GuiCommand {
impl fmt::Display for GuiCommand {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
GuiCommand::GameOver(ref r) => write!(f, "gameover {}", r),
GuiCommand::Go(ref opt) => write!(f, "go{}", opt),
GuiCommand::GameOver(ref r) => write!(f, "gameover {r}"),
GuiCommand::Go(ref opt) => write!(f, "go{opt}"),
GuiCommand::IsReady => write!(f, "isready"),
GuiCommand::Ponderhit => write!(f, "ponderhit"),
GuiCommand::Position(ref s) => write!(f, "position sfen {}", s),
GuiCommand::SetOption(ref n, None) => write!(f, "setoption name {}", n),
GuiCommand::Position(ref s) => write!(f, "position sfen {s}"),
GuiCommand::SetOption(ref n, None) => write!(f, "setoption name {n}"),
GuiCommand::SetOption(ref n, Some(ref v)) => {
write!(f, "setoption name {} value {}", n, v)
write!(f, "setoption name {n} value {v}")
}
GuiCommand::Stop => write!(f, "stop"),
GuiCommand::Usi => write!(f, "usi"),
Expand Down

0 comments on commit dbfd757

Please sign in to comment.