Skip to content

Commit

Permalink
Fix new clippy warnings and upgrade dependencies (#169)
Browse files Browse the repository at this point in the history
The new clippy release that comes with Rust 1.62.0 has some new lints
enabled by defaults. Those need to be fixed to make CI happy. Use this
opportunity for minor dependency upgrades.
  • Loading branch information
rkusa authored Jul 2, 2022
1 parent c9a73b4 commit 32e7c21
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 38 deletions.
68 changes: 34 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub fn next(lua: &Lua, (env, callback): (i32, Function)) -> LuaResult<bool> {
};

if let Some(mut next) = next {
let _call = server.stats().track_call();
server.stats().track_call();

let method = next.method().to_string();
let params = next
Expand Down Expand Up @@ -274,6 +274,8 @@ pub fn dcs_grpc(lua: &Lua) -> LuaResult<LuaTable> {
}

fn pretty_print_value(val: Value, indent: usize) -> LuaResult<String> {
use std::fmt::Write;

Ok(match val {
Value::Nil => "nil".to_string(),
Value::Boolean(v) => v.to_string(),
Expand All @@ -285,14 +287,15 @@ fn pretty_print_value(val: Value, indent: usize) -> LuaResult<String> {
let mut s = "{\n".to_string();
for pair in t.pairs::<Value, Value>() {
let (key, value) = pair?;
s += &format!(
"{}{} = {},\n",
let _ = writeln!(
s,
"{}{} = {},",
" ".repeat(indent + 1),
pretty_print_value(key, indent + 1)?,
pretty_print_value(value, indent + 1)?
);
}
s += &format!("{}}}", " ".repeat(indent));
let _ = write!(s, "{}}}", " ".repeat(indent));
s
}
Value::Function(_) => "[function]".to_string(),
Expand Down

0 comments on commit 32e7c21

Please sign in to comment.