Skip to content

Commit 915b00c

Browse files
committed
Fix various new clippy warnings
1 parent b3cc7cf commit 915b00c

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

compiler/src/json.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
//! we need for the compiler.
66
//!
77
//! The implementation here is based on `std.json` from Inko's standard library.
8+
use std::fmt::Display;
89
use std::string::ToString;
910

1011
const DQUOTE: i64 = 0x22;
@@ -62,9 +63,9 @@ pub(crate) enum Json {
6263
Bool(bool),
6364
}
6465

65-
impl ToString for Json {
66-
fn to_string(&self) -> String {
67-
Generator::new().generate(self)
66+
impl Display for Json {
67+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
68+
Generator::new().generate(self).fmt(f)
6869
}
6970
}
7071

@@ -166,10 +167,8 @@ mod tests {
166167
obj.add("array", Json::Array(vec![Json::Int(10), Json::Int(20)]));
167168
obj.add("bool", Json::Bool(true));
168169

169-
let json = Generator::new().generate(&Json::Object(obj));
170-
171170
assert_eq!(
172-
json,
171+
Json::Object(obj).to_string(),
173172
"{
174173
\"string\": \"foo\\nbar\",
175174
\"int\": 42,

compiler/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![allow(clippy::new_without_default)]
22
#![allow(clippy::enum_variant_names)]
3+
#![allow(clippy::assigning_clones)]
34

45
mod diagnostics;
56
pub mod docs;

compiler/src/mir/passes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ impl DecisionState {
428428
action: RegisterAction,
429429
) {
430430
self.actions.insert(child, action);
431-
self.child_registers.entry(parent).or_insert_with(Vec::new).push(child);
431+
self.child_registers.entry(parent).or_default().push(child);
432432
}
433433
}
434434

inko/src/main.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::assigning_clones)]
2+
13
mod command;
24
mod error;
35
mod http;

0 commit comments

Comments
 (0)