Skip to content

Commit 0774930

Browse files
committed
Fix log formatting in tests
Clippy points out that "format specifiers have no effect on `format_args!()`", i.e. that our attempt to fix the log context width to 55 chars doesn't do anything because its applied to the result of `format_args`ing the context. This appears to have broken when we optimized out a previous `format`, which we revert here.
1 parent 50a75a1 commit 0774930

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

lightning/src/util/test_utils.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,17 +1435,9 @@ impl TestLogger {
14351435

14361436
impl Logger for TestLogger {
14371437
fn log(&self, record: Record) {
1438-
let s = format!(
1439-
"{:<55} {}",
1440-
format_args!(
1441-
"{} {} [{}:{}]",
1442-
self.id,
1443-
record.level.to_string(),
1444-
record.module_path,
1445-
record.line
1446-
),
1447-
record.args
1448-
);
1438+
let context =
1439+
format!("{} {} [{}:{}]", self.id, record.level, record.module_path, record.line);
1440+
let s = format!("{:<55} {}", context, record.args);
14491441
#[cfg(ldk_bench)]
14501442
{
14511443
// When benchmarking, we don't actually want to print logs, but we do want to format

0 commit comments

Comments
 (0)