From 263208b9305f614a6c111555cf9c3d6186bbc356 Mon Sep 17 00:00:00 2001 From: xfy Date: Mon, 15 Jun 2026 11:22:35 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E4=BF=AE=E6=AD=A3=E6=96=B0=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=9A=84=E6=A0=BC=E5=BC=8F=E4=BB=A5=E7=AC=A6=E5=90=88?= =?UTF-8?q?=20rustfmt=20=E5=AE=BD=E5=BA=A6=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cargo fmt 自动调整了 highlight.rs 与 error.rs 中新增测试的 assert! / assert_eq! 长行折行。 --- src/api/error.rs | 5 ++++- src/highlight.rs | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/api/error.rs b/src/api/error.rs index 412fcd3..bc63ee5 100644 --- a/src/api/error.rs +++ b/src/api/error.rs @@ -121,7 +121,10 @@ mod tests { let err: ServerFnError = AppError::tx("deadlock detected on UPDATE posts").into(); let msg = err.to_string(); assert!(!msg.contains("UPDATE"), "should not leak SQL: {msg}"); - assert!(!msg.contains("deadlock"), "should not leak error detail: {msg}"); + assert!( + !msg.contains("deadlock"), + "should not leak error detail: {msg}" + ); assert!(msg.contains("操作失败"), "expected generic message: {msg}"); } diff --git a/src/highlight.rs b/src/highlight.rs index 7947e0d..dcc56c6 100644 --- a/src/highlight.rs +++ b/src/highlight.rs @@ -215,7 +215,9 @@ mod tests { let result = highlight_code(code, Some("rust")); // 两处 fn 关键字都应出现 assert_eq!( - result.matches(r#"fn"#).count(), + result + .matches(r#"fn"#) + .count(), 2 ); }