From ebb14559217ed46b56a9ec96c79063ea03ad8793 Mon Sep 17 00:00:00 2001 From: tison Date: Thu, 18 Jun 2026 03:55:14 +0800 Subject: [PATCH 1/6] chore: rework examples Signed-off-by: tison --- Cargo.lock | 155 +++++++++++++++++++------------ Cargo.toml | 2 +- examples/Cargo.toml | 2 +- examples/src/antipattern.rs | 2 +- examples/src/basic.rs | 2 +- examples/src/downcast.rs | 2 +- examples/src/from-anyhow.rs | 2 +- examples/src/into-anyhow.rs | 2 +- examples/src/into-std-error.rs | 2 +- examples/src/library-boundary.rs | 4 +- 10 files changed, 104 insertions(+), 71 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0080b0d..0761e51 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,15 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + [[package]] name = "anstream" version = "0.6.21" @@ -128,38 +137,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "convert_case" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "derive_more" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10b768e943bed7bf2cab53df09f4bc34bfd217cdb57d971e769874c9a6710618" -dependencies = [ - "derive_more-impl", -] - -[[package]] -name = "derive_more-impl" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d286bfdaf75e988b4a78e013ecd79c581e06399ab53fbacd2d916c2f904f30b" -dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "rustc_version", - "syn", - "unicode-xid", -] - [[package]] name = "encode_unicode" version = "1.0.0" @@ -187,9 +164,9 @@ name = "examples" version = "0.0.0" dependencies = [ "anyhow", - "derive_more", "exn", "exn-anyhow", + "parse-display", ] [[package]] @@ -261,6 +238,12 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" +[[package]] +name = "memchr" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4" + [[package]] name = "once_cell" version = "1.21.3" @@ -273,20 +256,45 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" +[[package]] +name = "parse-display" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78deb158fb1d73b29efb4b7e9b9860b78059c670de06bd28df8d0b458ded0eb" +dependencies = [ + "parse-display-derive", + "regex", + "regex-syntax", +] + +[[package]] +name = "parse-display-derive" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e95a50d1084dab562913062c4c34bb204b68fc6ec38a1395909ff5aaaf4f10a" +dependencies = [ + "proc-macro2", + "quote", + "regex", + "regex-syntax", + "structmeta", + "syn", +] + [[package]] name = "proc-macro2" -version = "1.0.103" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.42" +version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" dependencies = [ "proc-macro2", ] @@ -298,14 +306,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" [[package]] -name = "rustc_version" -version = "0.4.1" +name = "regex" +version = "1.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" dependencies = [ - "semver", + "aho-corasick", + "memchr", + "regex-syntax", ] +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + [[package]] name = "rustix" version = "1.1.2" @@ -319,12 +347,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "semver" -version = "1.0.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" - [[package]] name = "similar" version = "2.7.0" @@ -337,11 +359,34 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "structmeta" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e1575d8d40908d70f6fd05537266b90ae71b15dbbe7a8b7dffa2b759306d329" +dependencies = [ + "proc-macro2", + "quote", + "structmeta-derive", + "syn", +] + +[[package]] +name = "structmeta-derive" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "152a0b65a590ff6c3da95cabe2353ee04e6167c896b28e3b14478c2636c922fc" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "syn" -version = "2.0.111" +version = "2.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" +checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422" dependencies = [ "proc-macro2", "quote", @@ -367,18 +412,6 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" -[[package]] -name = "unicode-segmentation" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" - -[[package]] -name = "unicode-xid" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" - [[package]] name = "utf8parse" version = "0.2.2" diff --git a/Cargo.toml b/Cargo.toml index 8d596d8..8730a74 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,8 +32,8 @@ exn-anyhow = { version = "0.1.0", path = "exn-anyhow" } # Crates.io dependencies anyhow = { version = "1.0.100" } clap = { version = "4.5.20", features = ["derive"] } -derive_more = { version = "2.1.0", features = ["full"] } insta = { version = "1.45.1" } +parse-display = { version = "0.11.0", features = ["default"] } which = { version = "8.0.0" } [workspace.lints.rust] diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 453f66f..2da82f8 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -55,9 +55,9 @@ release = false [dev-dependencies] anyhow = { workspace = true } -derive_more = { workspace = true } exn = { workspace = true } exn-anyhow = { workspace = true } +parse-display = { workspace = true } [lints] workspace = true diff --git a/examples/src/antipattern.rs b/examples/src/antipattern.rs index 1a5006d..45d7f17 100644 --- a/examples/src/antipattern.rs +++ b/examples/src/antipattern.rs @@ -26,10 +26,10 @@ //! **The Fix:** Describe what **this layer** is doing. The app runs tasks, //! so say "failed to run app" - the HTTP details come from the child error. -use derive_more::Display; use exn::Result; use exn::ResultExt; use exn::bail; +use parse_display::Display; fn main() -> Result<(), MainError> { app::run().or_raise(|| MainError)?; diff --git a/examples/src/basic.rs b/examples/src/basic.rs index e1d5e43..21636f5 100644 --- a/examples/src/basic.rs +++ b/examples/src/basic.rs @@ -25,10 +25,10 @@ //! 3. **Keep Errors Simple** - Use `struct Error(String)` by default. Only add complexity (enums, //! fields) when needed for programmatic handling. -use derive_more::Display; use exn::Result; use exn::ResultExt; use exn::bail; +use parse_display::Display; fn main() -> Result<(), MainError> { app::run().or_raise(|| MainError)?; diff --git a/examples/src/downcast.rs b/examples/src/downcast.rs index 37212c4..7818148 100644 --- a/examples/src/downcast.rs +++ b/examples/src/downcast.rs @@ -23,12 +23,12 @@ use std::error::Error; -use derive_more::Display; use exn::Exn; use exn::Frame; use exn::Result; use exn::ResultExt; use exn::bail; +use parse_display::Display; use crate::http::HttpError; diff --git a/examples/src/from-anyhow.rs b/examples/src/from-anyhow.rs index 43dc7a7..62f4f85 100644 --- a/examples/src/from-anyhow.rs +++ b/examples/src/from-anyhow.rs @@ -18,10 +18,10 @@ //! - Legacy code returns `anyhow::Result`. //! - At the boundary, convert into `exn::Result`. -use derive_more::Display; use exn::Result; use exn::ResultExt; use exn_anyhow::from_anyhow; +use parse_display::Display; fn main() -> Result<(), MainError> { app::run().or_raise(|| MainError)?; diff --git a/examples/src/into-anyhow.rs b/examples/src/into-anyhow.rs index 4ee9693..9cbbe8f 100644 --- a/examples/src/into-anyhow.rs +++ b/examples/src/into-anyhow.rs @@ -20,10 +20,10 @@ use std::error::Error; -use derive_more::Display; use exn::Result; use exn::ResultExt; use exn_anyhow::into_anyhow; +use parse_display::Display; fn main() -> anyhow::Result<()> { app::run().map_err(into_anyhow)?; diff --git a/examples/src/into-std-error.rs b/examples/src/into-std-error.rs index 6a8a512..99d7ef7 100644 --- a/examples/src/into-std-error.rs +++ b/examples/src/into-std-error.rs @@ -20,9 +20,9 @@ use std::error::Error; -use derive_more::Display; use exn::Result; use exn::ResultExt; +use parse_display::Display; fn main() -> std::result::Result<(), Box> { app::run()?; diff --git a/examples/src/library-boundary.rs b/examples/src/library-boundary.rs index 0a96ff4..caae4bf 100644 --- a/examples/src/library-boundary.rs +++ b/examples/src/library-boundary.rs @@ -22,12 +22,12 @@ use std::error::Error; -use derive_more::Display; use exn::Exn; use exn::Frame; use exn::Result; use exn::ResultExt; use exn::bail; +use parse_display::Display; fn main() { demo(429); @@ -176,7 +176,7 @@ mod library { } #[derive(Debug, Display)] - #[display("{_0}")] + #[display("{0}")] pub struct ServiceError(String); impl Error for ServiceError {} } From bc6878c1f917694b8221144c257c3d45c7f4beef Mon Sep 17 00:00:00 2001 From: tison Date: Thu, 18 Jun 2026 04:14:24 +0800 Subject: [PATCH 2/6] examples tests Signed-off-by: tison --- Cargo.lock | 1 + examples/Cargo.toml | 1 + examples/src/antipattern.rs | 7 --- examples/src/basic.rs | 6 --- examples/src/custom-layout.rs | 6 --- examples/src/downcast.rs | 16 ------ examples/src/from-anyhow.rs | 7 --- examples/src/into-anyhow.rs | 8 --- examples/src/into-std-error.rs | 6 --- examples/src/library-boundary.rs | 23 --------- .../tests/snapshots/tests__antipattern.snap | 7 +++ examples/tests/snapshots/tests__basic.snap | 7 +++ .../tests/snapshots/tests__custom-layout.snap | 7 +++ examples/tests/snapshots/tests__downcast.snap | 17 +++++++ .../tests/snapshots/tests__from-anyhow.snap | 8 +++ .../tests/snapshots/tests__into-anyhow.snap | 9 ++++ .../snapshots/tests__into-std-error.snap | 7 +++ .../snapshots/tests__library-boundary.snap | 24 +++++++++ examples/tests/tests.rs | 50 +++++++++++++++++++ 19 files changed, 138 insertions(+), 79 deletions(-) create mode 100644 examples/tests/snapshots/tests__antipattern.snap create mode 100644 examples/tests/snapshots/tests__basic.snap create mode 100644 examples/tests/snapshots/tests__custom-layout.snap create mode 100644 examples/tests/snapshots/tests__downcast.snap create mode 100644 examples/tests/snapshots/tests__from-anyhow.snap create mode 100644 examples/tests/snapshots/tests__into-anyhow.snap create mode 100644 examples/tests/snapshots/tests__into-std-error.snap create mode 100644 examples/tests/snapshots/tests__library-boundary.snap create mode 100644 examples/tests/tests.rs diff --git a/Cargo.lock b/Cargo.lock index 0761e51..a2c9052 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -166,6 +166,7 @@ dependencies = [ "anyhow", "exn", "exn-anyhow", + "insta", "parse-display", ] diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 2da82f8..4905be6 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -57,6 +57,7 @@ release = false anyhow = { workspace = true } exn = { workspace = true } exn-anyhow = { workspace = true } +insta = { workspace = true } parse-display = { workspace = true } [lints] diff --git a/examples/src/antipattern.rs b/examples/src/antipattern.rs index 45d7f17..315d306 100644 --- a/examples/src/antipattern.rs +++ b/examples/src/antipattern.rs @@ -84,10 +84,3 @@ mod http { } impl std::error::Error for HttpError {} } - -// Output when running `cargo run --example antipattern`. -// Notice "failed to send request" appears twice with no new information. -// -// Error: fatal error occurred in application, at examples/src/antipattern.rs:35:16 -// |-- failed to send request, at examples/src/antipattern.rs:59:34 -// `-- failed to send request to server: 127.0.0.1, at examples/src/antipattern.rs:75:9 diff --git a/examples/src/basic.rs b/examples/src/basic.rs index 21636f5..83a81fd 100644 --- a/examples/src/basic.rs +++ b/examples/src/basic.rs @@ -68,9 +68,3 @@ mod http { pub struct HttpError(String); impl std::error::Error for HttpError {} } - -// Output when running `cargo run --example basic`: -// -// Error: fatal error occurred in application, at examples/src/basic.rs:34:16 -// |-- failed to run app, at examples/src/basic.rs:49:14 -// `-- failed to send request to server: https://example.com, at examples/src/basic.rs:62:9 diff --git a/examples/src/custom-layout.rs b/examples/src/custom-layout.rs index 4311066..d8e89c8 100644 --- a/examples/src/custom-layout.rs +++ b/examples/src/custom-layout.rs @@ -109,9 +109,3 @@ mod http { impl Error for HttpError {} } - -// Output when running `cargo run --example custom_layout`: -// -// Error: fatal error occurred in application: -// 0: failed to run app, at examples/src/custom-layout.rs:74:30 -// 1: failed to send request to server: https://example.com, at examples/src/custom-layout.rs:94:9 diff --git a/examples/src/downcast.rs b/examples/src/downcast.rs index 7818148..159004d 100644 --- a/examples/src/downcast.rs +++ b/examples/src/downcast.rs @@ -106,19 +106,3 @@ mod http { } impl Error for HttpError {} } - -// Output when running `cargo run --example downcast`: -// -// HTTP error with status code: 503 -// Retryable error, attempting retry #1 -// -// HTTP error with status code: 503 -// Retryable error, attempting retry #2 -// -// HTTP error with status code: 503 -// Retryable error, attempting retry #3 -// -// HTTP error with status code: 503 -// Error: fatal error occurred in application, at examples/src/downcast.rs:54:24 -// |-- failed to run app, at examples/src/downcast.rs:82:35 -// `-- HTTP 503: service unavailable, at examples/src/downcast.rs:95:9 diff --git a/examples/src/from-anyhow.rs b/examples/src/from-anyhow.rs index 62f4f85..cb00404 100644 --- a/examples/src/from-anyhow.rs +++ b/examples/src/from-anyhow.rs @@ -62,10 +62,3 @@ mod legacy { Ok(port) } } - -// Output when running `cargo run -p examples --example from-anyhow`: -// -// Error: fatal error occurred in application, at examples/src/from-anyhow.rs:27:16 -// |-- failed to run app, at examples/src/from-anyhow.rs:42:14 -// |-- PORT must be a number; got "not-a-number", at exn-anyhow/src/lib.rs:51:19 -// `-- invalid digit found in string, at exn-anyhow/src/lib.rs:48:19 diff --git a/examples/src/into-anyhow.rs b/examples/src/into-anyhow.rs index 9cbbe8f..f301792 100644 --- a/examples/src/into-anyhow.rs +++ b/examples/src/into-anyhow.rs @@ -62,11 +62,3 @@ mod config { pub struct ConfigError(String); impl Error for ConfigError {} } - -// Output when running `cargo run -p examples --example into-anyhow`: -// -// Error: failed to start app -// -// Caused by: -// 0: PORT must be a number; got "not-a-number" -// 1: invalid digit found in string diff --git a/examples/src/into-std-error.rs b/examples/src/into-std-error.rs index 99d7ef7..4540760 100644 --- a/examples/src/into-std-error.rs +++ b/examples/src/into-std-error.rs @@ -61,9 +61,3 @@ mod config { pub struct ConfigError(String); impl Error for ConfigError {} } - -// Output when running `cargo run -p examples --example into-std-error`: -// -// Error: failed to start app, at examples/src/into-std-error.rs:36:40 -// |-- PORT must be a number; got "not-a-number", at examples/src/into-std-error.rs:55:14 -// `-- invalid digit found in string, at examples/src/into-std-error.rs:55:14 diff --git a/examples/src/library-boundary.rs b/examples/src/library-boundary.rs index caae4bf..b1e9adc 100644 --- a/examples/src/library-boundary.rs +++ b/examples/src/library-boundary.rs @@ -237,26 +237,3 @@ mod library { impl Error for HttpError {} } } - -// Output when running `cargo run -p examples --example library-boundary`: -// -// Start demo for user: 429 -// RateLimited: rate limited by upstream -// Retryable error, attempting retry #1 -// -// RateLimited: rate limited by upstream -// Retryable error, attempting retry #2 -// -// RateLimited: rate limited by upstream -// Retryable error, attempting retry #3 -// -// Action: Retried too many times, aborting -// Error: RateLimited: rate limited by upstream, at examples/src/library-boundary.rs:149:13 -// |-- failed to fetch profile for user 429, at examples/src/library-boundary.rs:170:55 -// `-- HTTP 429: too many requests, at examples/src/library-boundary.rs:218:24 -// -// Start demo for user: 404 -// Action: Return 404 -// Error: NotFound: user 404 not found, at examples/src/library-boundary.rs:149:13 -// |-- failed to fetch profile for user 404, at examples/src/library-boundary.rs:169:47 -// `-- no row for user_id 404, at examples/src/library-boundary.rs:189:24 diff --git a/examples/tests/snapshots/tests__antipattern.snap b/examples/tests/snapshots/tests__antipattern.snap new file mode 100644 index 0000000..001feb1 --- /dev/null +++ b/examples/tests/snapshots/tests__antipattern.snap @@ -0,0 +1,7 @@ +--- +source: examples/tests/tests.rs +expression: "capture_output(\"antipattern\")" +--- +Error: fatal error occurred in application, at examples/src/antipattern.rs:35:16 +|-- failed to send request, at examples/src/antipattern.rs:59:34 +`-- failed to send request to server: 127.0.0.1, at examples/src/antipattern.rs:75:9 diff --git a/examples/tests/snapshots/tests__basic.snap b/examples/tests/snapshots/tests__basic.snap new file mode 100644 index 0000000..0d5333c --- /dev/null +++ b/examples/tests/snapshots/tests__basic.snap @@ -0,0 +1,7 @@ +--- +source: examples/tests/tests.rs +expression: "capture_output(\"basic\")" +--- +Error: fatal error occurred in application, at examples/src/basic.rs:34:16 +|-- failed to run app, at examples/src/basic.rs:49:14 +`-- failed to send request to server: https://example.com, at examples/src/basic.rs:62:9 diff --git a/examples/tests/snapshots/tests__custom-layout.snap b/examples/tests/snapshots/tests__custom-layout.snap new file mode 100644 index 0000000..37c7e5e --- /dev/null +++ b/examples/tests/snapshots/tests__custom-layout.snap @@ -0,0 +1,7 @@ +--- +source: examples/tests/tests.rs +expression: "capture_output(\"custom-layout\")" +--- +Error: fatal error occurred in application: +0: failed to run app, at examples/src/custom-layout.rs:74:30 +1: failed to send request to server: https://example.com, at examples/src/custom-layout.rs:94:9 diff --git a/examples/tests/snapshots/tests__downcast.snap b/examples/tests/snapshots/tests__downcast.snap new file mode 100644 index 0000000..60df7a2 --- /dev/null +++ b/examples/tests/snapshots/tests__downcast.snap @@ -0,0 +1,17 @@ +--- +source: examples/tests/tests.rs +expression: "capture_output(\"downcast\")" +--- +HTTP error with status code: 503 +Retryable error, attempting retry #1 + +HTTP error with status code: 503 +Retryable error, attempting retry #2 + +HTTP error with status code: 503 +Retryable error, attempting retry #3 + +HTTP error with status code: 503 +Error: fatal error occurred in application, at examples/src/downcast.rs:54:24 +|-- failed to run app, at examples/src/downcast.rs:82:35 +`-- HTTP 503: service unavailable, at examples/src/downcast.rs:95:9 diff --git a/examples/tests/snapshots/tests__from-anyhow.snap b/examples/tests/snapshots/tests__from-anyhow.snap new file mode 100644 index 0000000..37ac637 --- /dev/null +++ b/examples/tests/snapshots/tests__from-anyhow.snap @@ -0,0 +1,8 @@ +--- +source: examples/tests/tests.rs +expression: "capture_output(\"from-anyhow\")" +--- +Error: fatal error occurred in application, at examples/src/from-anyhow.rs:27:16 +|-- failed to run app, at examples/src/from-anyhow.rs:42:14 +|-- PORT must be a number; got "not-a-number", at exn-anyhow/src/lib.rs:51:19 +`-- invalid digit found in string, at exn-anyhow/src/lib.rs:48:19 diff --git a/examples/tests/snapshots/tests__into-anyhow.snap b/examples/tests/snapshots/tests__into-anyhow.snap new file mode 100644 index 0000000..ac4f5eb --- /dev/null +++ b/examples/tests/snapshots/tests__into-anyhow.snap @@ -0,0 +1,9 @@ +--- +source: examples/tests/tests.rs +expression: "capture_output(\"into-anyhow\")" +--- +Error: failed to start app + +Caused by: + 0: PORT must be a number; got "not-a-number" + 1: invalid digit found in string diff --git a/examples/tests/snapshots/tests__into-std-error.snap b/examples/tests/snapshots/tests__into-std-error.snap new file mode 100644 index 0000000..65ec088 --- /dev/null +++ b/examples/tests/snapshots/tests__into-std-error.snap @@ -0,0 +1,7 @@ +--- +source: examples/tests/tests.rs +expression: "capture_output(\"into-std-error\")" +--- +Error: failed to start app, at examples/src/into-std-error.rs:36:40 +|-- PORT must be a number; got "not-a-number", at examples/src/into-std-error.rs:55:14 +`-- invalid digit found in string, at examples/src/into-std-error.rs:55:14 diff --git a/examples/tests/snapshots/tests__library-boundary.snap b/examples/tests/snapshots/tests__library-boundary.snap new file mode 100644 index 0000000..d4ce56e --- /dev/null +++ b/examples/tests/snapshots/tests__library-boundary.snap @@ -0,0 +1,24 @@ +--- +source: examples/tests/tests.rs +expression: "capture_output(\"library-boundary\")" +--- +Start demo for user: 429 +RateLimited: rate limited by upstream +Retryable error, attempting retry #1 + +RateLimited: rate limited by upstream +Retryable error, attempting retry #2 + +RateLimited: rate limited by upstream +Retryable error, attempting retry #3 + +Action: Retried too many times, aborting +Error: RateLimited: rate limited by upstream, at examples/src/library-boundary.rs:149:13 +|-- failed to fetch profile for user 429, at examples/src/library-boundary.rs:170:55 +`-- HTTP 429: too many requests, at examples/src/library-boundary.rs:218:24 + +Start demo for user: 404 +Action: Return 404 +Error: NotFound: user 404 not found, at examples/src/library-boundary.rs:149:13 +|-- failed to fetch profile for user 404, at examples/src/library-boundary.rs:169:47 +`-- no row for user_id 404, at examples/src/library-boundary.rs:189:24 diff --git a/examples/tests/tests.rs b/examples/tests/tests.rs new file mode 100644 index 0000000..e7b8cad --- /dev/null +++ b/examples/tests/tests.rs @@ -0,0 +1,50 @@ +use insta::assert_snapshot; +use std::fs; +use std::path::PathBuf; +use std::process::Command; + +#[test] +fn snapshots() { + fn capture_output(name: &str) -> String { + let mut cargo = Command::new("cargo"); + cargo.current_dir(env!("CARGO_MANIFEST_DIR")); + cargo.args(["run", "--example", name, "--quiet"]); + + let output = cargo.output().unwrap(); + String::from_utf8_lossy(&output.stderr).to_string() + } + + assert_snapshot!("antipattern", capture_output("antipattern")); + assert_snapshot!("basic", capture_output("basic")); + assert_snapshot!("custom-layout", capture_output("custom-layout")); + assert_snapshot!("downcast", capture_output("downcast")); + assert_snapshot!("from-anyhow", capture_output("from-anyhow")); + assert_snapshot!("into-anyhow", capture_output("into-anyhow")); + assert_snapshot!("into-std-error", capture_output("into-std-error")); + assert_snapshot!("library-boundary", capture_output("library-boundary")); +} + +#[test] +fn coverage() { + let examples_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("src"); + let snapshots_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/snapshots"); + + let entries = fs::read_dir(&examples_dir).unwrap_or_else(|err| { + panic!("failed to read examples directory at {examples_dir:?}: {err:?}") + }); + + for entry in entries { + let entry = entry.unwrap(); + let path = entry.path(); + if path.extension().and_then(|s| s.to_str()) != Some("rs") { + unreachable!("all examples files should be rs files"); + } + + let example_name = path.file_stem().unwrap().to_str().unwrap(); + let snapshot_path = snapshots_dir.join(format!("tests__{example_name}.snap")); + assert!( + snapshot_path.exists(), + "snapshot for example {example_name} does not exist" + ); + } +} From 5c46c1aa39c3d529916dd3cd55b39b24a4dba803 Mon Sep 17 00:00:00 2001 From: tison Date: Thu, 18 Jun 2026 04:16:08 +0800 Subject: [PATCH 3/6] drop handy trick Signed-off-by: tison --- .github/workflows/ci.yml | 6 ---- examples/tests/tests.rs | 17 ++++++++++- xtask/src/main.rs | 64 ---------------------------------------- 3 files changed, 16 insertions(+), 71 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d839d30..9ec35c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,12 +64,6 @@ jobs: uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust-version }} - - name: Adjust snapshots on Windows - if: ${{ startsWith(matrix.os, 'windows') }} - run: | - perl -i -pe 's/\//\\/g if /at exn/' exn/tests/snapshots/*.snap - perl -i -pe 's/(? String { diff --git a/xtask/src/main.rs b/xtask/src/main.rs index ff47c44..4da110f 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::fs; -use std::path::PathBuf; use std::process::Command as StdCommand; use clap::Parser; @@ -66,7 +64,6 @@ struct CommandTest { impl CommandTest { fn run(self) { run_command(make_test_cmd(self.no_capture, true, &[])); - run_example_tests(); } } @@ -87,67 +84,6 @@ impl CommandLint { } } -fn run_example_tests() { - let examples_dir = PathBuf::from(env!("CARGO_WORKSPACE_DIR")) - .join("examples") - .join("src"); - - let entries = fs::read_dir(&examples_dir).unwrap_or_else(|err| { - panic!("failed to read examples directory at {examples_dir:?}: {err:?}") - }); - - let mut total = 0; - let mut failed = vec![]; - for entry in entries { - let entry = entry.unwrap(); - let path = entry.path(); - - if path.extension().and_then(|s| s.to_str()) != Some("rs") { - continue; - } - - let example_name = path.file_stem().unwrap().to_str().unwrap(); - - let mut cmd = find_command("cargo"); - cmd.args(["--quiet", "run", "--example", example_name]); - - let output = cmd.output().unwrap(); - let stderr = String::from_utf8_lossy(&output.stderr); - - let content = fs::read_to_string(&path).unwrap(); - let content = content.lines().collect::>().join("\n"); - - let actual = stderr - .lines() - .map(|line| { - if line.is_empty() { - "//".to_string() - } else { - format!("// {}", line) - } - }) - .collect::>() - .join("\n"); - - if !content.contains(&actual) { - failed.push((path, actual)); - } - - total += 1; - } - - if !failed.is_empty() { - eprintln!("{}/{} example tests failed:", failed.len(), total); - for (path, actual) in failed { - eprintln!("\nexample: {}", path.display()); - eprintln!("actual stderr:\n{}", actual); - } - std::process::exit(1); - } else { - println!("all {} example tests passed", total); - } -} - fn find_command(cmd: &str) -> StdCommand { match which::which(cmd) { Ok(exe) => { From 2c97b0fc5af7f563abda51ab912ba2aa51549e05 Mon Sep 17 00:00:00 2001 From: tison Date: Thu, 18 Jun 2026 04:18:21 +0800 Subject: [PATCH 4/6] update Signed-off-by: tison --- examples/src/library-boundary.rs | 1 - examples/tests/snapshots/tests__library-boundary.snap | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/src/library-boundary.rs b/examples/src/library-boundary.rs index b1e9adc..7f64e11 100644 --- a/examples/src/library-boundary.rs +++ b/examples/src/library-boundary.rs @@ -176,7 +176,6 @@ mod library { } #[derive(Debug, Display)] - #[display("{0}")] pub struct ServiceError(String); impl Error for ServiceError {} } diff --git a/examples/tests/snapshots/tests__library-boundary.snap b/examples/tests/snapshots/tests__library-boundary.snap index d4ce56e..5dc2690 100644 --- a/examples/tests/snapshots/tests__library-boundary.snap +++ b/examples/tests/snapshots/tests__library-boundary.snap @@ -15,10 +15,10 @@ Retryable error, attempting retry #3 Action: Retried too many times, aborting Error: RateLimited: rate limited by upstream, at examples/src/library-boundary.rs:149:13 |-- failed to fetch profile for user 429, at examples/src/library-boundary.rs:170:55 -`-- HTTP 429: too many requests, at examples/src/library-boundary.rs:218:24 +`-- HTTP 429: too many requests, at examples/src/library-boundary.rs:217:24 Start demo for user: 404 Action: Return 404 Error: NotFound: user 404 not found, at examples/src/library-boundary.rs:149:13 |-- failed to fetch profile for user 404, at examples/src/library-boundary.rs:169:47 -`-- no row for user_id 404, at examples/src/library-boundary.rs:189:24 +`-- no row for user_id 404, at examples/src/library-boundary.rs:188:24 From 4e7ce712840201be8d343d290023e5b53da5b561 Mon Sep 17 00:00:00 2001 From: tison Date: Thu, 18 Jun 2026 04:19:59 +0800 Subject: [PATCH 5/6] deps Signed-off-by: tison --- Cargo.lock | 206 +++++++++++++---------------------------------------- 1 file changed, 51 insertions(+), 155 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a2c9052..331d4f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,9 +13,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.21" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" dependencies = [ "anstyle", "anstyle-parse", @@ -28,15 +28,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" [[package]] name = "anstyle-parse" -version = "0.2.7" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" dependencies = [ "utf8parse", ] @@ -47,7 +47,7 @@ version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.61.2", + "windows-sys", ] [[package]] @@ -58,20 +58,20 @@ checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", "once_cell_polyfill", - "windows-sys 0.61.2", + "windows-sys", ] [[package]] name = "anyhow" -version = "1.0.100" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" [[package]] name = "bitflags" -version = "2.10.0" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8" [[package]] name = "cfg-if" @@ -81,9 +81,9 @@ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "clap" -version = "4.5.53" +version = "4.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8" +checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" dependencies = [ "clap_builder", "clap_derive", @@ -91,9 +91,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.53" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" dependencies = [ "anstream", "anstyle", @@ -103,9 +103,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.49" +version = "4.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" +checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" dependencies = [ "heck", "proc-macro2", @@ -115,26 +115,25 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.6" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" [[package]] name = "colorchoice" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" [[package]] name = "console" -version = "0.15.11" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8" +checksum = "d64e8af5551369d19cf50138de61f1c42074ab970f74e99be916646777f8fc87" dependencies = [ "encode_unicode", "libc", - "once_cell", - "windows-sys 0.59.0", + "windows-sys", ] [[package]] @@ -143,12 +142,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" -[[package]] -name = "env_home" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f84e12ccf0a7ddc17a6c41c93326024c42920d7ee630d04950e6926645c0fe" - [[package]] name = "errno" version = "0.3.14" @@ -156,7 +149,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys", ] [[package]] @@ -187,20 +180,19 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.3.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" [[package]] name = "getrandom" -version = "0.3.4" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" dependencies = [ "cfg-if", "libc", "r-efi", - "wasip2", ] [[package]] @@ -211,9 +203,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "insta" -version = "1.45.1" +version = "1.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "983e3b24350c84ab8a65151f537d67afbbf7153bb9f1110e03e9fa9b07f67a5c" +checksum = "86f0f8fee8c926415c58d6ae43a08523a26faccb2323f5e6b644fe7dd4ef6b82" dependencies = [ "console", "once_cell", @@ -229,15 +221,15 @@ checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" [[package]] name = "libc" -version = "0.2.178" +version = "0.2.186" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" [[package]] name = "linux-raw-sys" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "memchr" @@ -247,9 +239,9 @@ checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4" [[package]] name = "once_cell" -version = "1.21.3" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] name = "once_cell_polyfill" @@ -302,9 +294,9 @@ dependencies = [ [[package]] name = "r-efi" -version = "5.3.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" [[package]] name = "regex" @@ -337,15 +329,15 @@ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" [[package]] name = "rustix" -version = "1.1.2" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys 0.61.2", + "windows-sys", ] [[package]] @@ -396,22 +388,22 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.23.0" +version = "3.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", "getrandom", "once_cell", "rustix", - "windows-sys 0.61.2", + "windows-sys", ] [[package]] name = "unicode-ident" -version = "1.0.22" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "utf8parse" @@ -419,24 +411,13 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" -[[package]] -name = "wasip2" -version = "1.0.1+wasi-0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" -dependencies = [ - "wit-bindgen", -] - [[package]] name = "which" -version = "8.0.0" +version = "8.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3fabb953106c3c8eea8306e4393700d7657561cb43122571b172bbfb7c7ba1d" +checksum = "48d7cd18d4acb58fb3cdfe9ea54e6cd96a4e7d4cc45c56338b236e82dad47248" dependencies = [ - "env_home", - "rustix", - "winsafe", + "libc", ] [[package]] @@ -445,15 +426,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] - [[package]] name = "windows-sys" version = "0.61.2" @@ -463,82 +435,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "winsafe" -version = "0.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" - -[[package]] -name = "wit-bindgen" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" - [[package]] name = "x" version = "0.0.0" From 3acb504998407810ab9ac6720a772ace6ec04a82 Mon Sep 17 00:00:00 2001 From: tison Date: Thu, 18 Jun 2026 04:41:03 +0800 Subject: [PATCH 6/6] restore perl trick Signed-off-by: tison --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ec35c4..6a911de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,6 +64,12 @@ jobs: uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust-version }} + - name: Adjust snapshots on Windows + if: ${{ startsWith(matrix.os, 'windows') }} + run: | + perl -i -pe 's/(?