diff --git a/CHANGELOG.md b/CHANGELOG.md index 772e619..7b3463e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,12 @@ All notable changes to this project will be documented in this file. The format [comment]: <> (Security: in case of vulnerabilities) +## [2.2.1] - 2024-06-21 + +### Added +* `--wrapper` option for using `rustc` wrapper to build reproducible wasm. + + ## [2.2.0] - 2024-02-09 diff --git a/Cargo.lock b/Cargo.lock index 43feda4..d137aeb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,16 +19,16 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "anstream" -version = "0.3.2" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", + "is_terminal_polyfill", "utf8parse", ] @@ -58,19 +58,19 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.2" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" dependencies = [ "anstyle", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "assert_cmd" -version = "2.0.13" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00ad3f3a942eee60335ab4342358c161ee296829e0d16ff42fc1d6cb07815467" +checksum = "ed72493ac66d5804837f480ab3766c72bdfab91a65e565fc54fa9e42db0073a8" dependencies = [ "anstyle", "bstr", @@ -81,6 +81,12 @@ dependencies = [ "wait-timeout", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" version = "1.1.0" @@ -104,9 +110,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.7" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bitflags" @@ -145,7 +151,7 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cargo-casper" -version = "2.2.0" +version = "2.2.1" dependencies = [ "assert_cmd", "clap", @@ -173,45 +179,31 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.3.24" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb690e81c7840c0d7aade59f242ea3b41b9bc27bcd5997890e7702ae4b32e487" +checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f" dependencies = [ "clap_builder", - "clap_derive", ] [[package]] name = "clap_builder" -version = "4.3.24" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ed2e96bc16d8d740f6f48d663eddf4b8a0983e79210fd55479b7bcd0a69860e" +checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f" dependencies = [ "anstream", "anstyle", "clap_lex", - "once_cell", "strsim", "terminal_size", ] -[[package]] -name = "clap_derive" -version = "4.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "clap_lex" -version = "0.5.1" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" [[package]] name = "colorchoice" @@ -221,11 +213,11 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "colour" -version = "0.7.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f58a501d883cdb7f1a780407eefba005458b8fdf7c09213ea0104879bf87aa9" +checksum = "b536eebcabe54980476d120a182f7da2268fe02d22575cca99cee5fdda178280" dependencies = [ - "crossterm", + "winapi", ] [[package]] @@ -244,31 +236,6 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" -[[package]] -name = "crossterm" -version = "0.26.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13" -dependencies = [ - "bitflags 1.3.2", - "crossterm_winapi", - "libc", - "mio", - "parking_lot", - "signal-hook", - "signal-hook-mio", - "winapi", -] - -[[package]] -name = "crossterm_winapi" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" -dependencies = [ - "winapi", -] - [[package]] name = "difflib" version = "0.4.0" @@ -349,6 +316,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", + "futures-sink", ] [[package]] @@ -383,6 +351,7 @@ checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-core", "futures-io", + "futures-sink", "futures-task", "memchr", "pin-project-lite", @@ -390,6 +359,17 @@ dependencies = [ "slab", ] +[[package]] +name = "getrandom" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + [[package]] name = "gimli" version = "0.28.1" @@ -398,15 +378,15 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "h2" -version = "0.3.24" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" +checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" dependencies = [ + "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "futures-util", "http", "indexmap", "slab", @@ -421,23 +401,11 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" - [[package]] name = "http" -version = "0.2.11" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -446,12 +414,24 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.6" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", + "futures-util", "http", + "http-body", "pin-project-lite", ] @@ -461,47 +441,77 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - [[package]] name = "hyper" -version = "0.14.28" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" dependencies = [ "bytes", "futures-channel", - "futures-core", "futures-util", "h2", "http", "http-body", "httparse", - "httpdate", "itoa", "pin-project-lite", - "socket2", + "smallvec", "tokio", - "tower-service", - "tracing", "want", ] +[[package]] +name = "hyper-rustls" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + [[package]] name = "hyper-tls" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", + "http-body-util", "hyper", + "hyper-util", "native-tls", "tokio", "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower", + "tower-service", + "tracing", ] [[package]] @@ -524,17 +534,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "ipnet" version = "2.9.0" @@ -542,15 +541,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] -name = "is-terminal" -version = "0.4.10" +name = "is_terminal_polyfill" +version = "1.70.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" -dependencies = [ - "hermit-abi", - "rustix 0.38.31", - "windows-sys 0.52.0", -] +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" [[package]] name = "itoa" @@ -579,28 +573,12 @@ version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" -[[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - [[package]] name = "linux-raw-sys" version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" -[[package]] -name = "lock_api" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" -dependencies = [ - "autocfg", - "scopeguard", -] - [[package]] name = "log" version = "0.4.20" @@ -635,7 +613,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", - "log", "wasi", "windows-sys 0.48.0", ] @@ -658,16 +635,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - [[package]] name = "object" version = "0.32.2" @@ -728,33 +695,30 @@ dependencies = [ ] [[package]] -name = "parking_lot" -version = "0.12.1" +name = "percent-encoding" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] -name = "parking_lot_core" -version = "0.9.9" +name = "pin-project" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.48.5", + "pin-project-internal", ] [[package]] -name = "percent-encoding" -version = "2.3.1" +name = "pin-project-internal" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] [[package]] name = "pin-project-lite" @@ -819,15 +783,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "regex-automata" version = "0.4.5" @@ -836,20 +791,24 @@ checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" [[package]] name = "reqwest" -version = "0.11.24" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" +checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" dependencies = [ "base64", "bytes", "encoding_rs", + "futures-channel", "futures-core", "futures-util", "h2", "http", "http-body", + "http-body-util", "hyper", + "hyper-rustls", "hyper-tls", + "hyper-util", "ipnet", "js-sys", "log", @@ -874,6 +833,21 @@ dependencies = [ "winreg", ] +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -882,38 +856,55 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.37.27" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.2", "errno", - "io-lifetimes", "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", + "linux-raw-sys", + "windows-sys 0.52.0", ] [[package]] -name = "rustix" -version = "0.38.31" +name = "rustls" +version = "0.23.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" +checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402" dependencies = [ - "bitflags 2.4.2", - "errno", - "libc", - "linux-raw-sys 0.4.13", - "windows-sys 0.52.0", + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", ] [[package]] name = "rustls-pemfile" -version = "1.0.4" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" dependencies = [ "base64", + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" + +[[package]] +name = "rustls-webpki" +version = "0.102.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", ] [[package]] @@ -931,12 +922,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - [[package]] name = "security-framework" version = "2.9.2" @@ -1003,36 +988,6 @@ dependencies = [ "serde", ] -[[package]] -name = "signal-hook" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" -dependencies = [ - "libc", - "signal-hook-registry", -] - -[[package]] -name = "signal-hook-mio" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" -dependencies = [ - "libc", - "mio", - "signal-hook", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" -dependencies = [ - "libc", -] - [[package]] name = "slab" version = "0.4.9" @@ -1058,11 +1013,23 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "0d0208408ba0c3df17ed26eb06992cb1a1268d41b2c0e12e65203fbe3972cee5" [[package]] name = "syn" @@ -1077,9 +1044,9 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "0.1.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" [[package]] name = "system-configuration" @@ -1110,17 +1077,17 @@ checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ "cfg-if", "fastrand", - "rustix 0.38.31", + "rustix", "windows-sys 0.52.0", ] [[package]] name = "terminal_size" -version = "0.2.6" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" dependencies = [ - "rustix 0.37.27", + "rustix", "windows-sys 0.48.0", ] @@ -1155,7 +1122,6 @@ dependencies = [ "bytes", "libc", "mio", - "num_cpus", "pin-project-lite", "socket2", "windows-sys 0.48.0", @@ -1171,6 +1137,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-util" version = "0.7.10" @@ -1185,6 +1162,27 @@ dependencies = [ "tracing", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + [[package]] name = "tower-service" version = "0.3.2" @@ -1237,6 +1235,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" version = "2.5.0" @@ -1516,10 +1520,16 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winreg" -version = "0.50.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" dependencies = [ "cfg-if", "windows-sys 0.48.0", ] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/Cargo.toml b/Cargo.toml index 24cb10e..1e1fc62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cargo-casper" -version = "2.2.0" +version = "2.2.1" authors = ["Fraser Hutchison "] edition = "2021" description = "A command line tool for creating a Wasm smart contract and tests for use on the Casper network." @@ -12,12 +12,12 @@ license = "Apache-2.0" include = ["src/*.rs", "Cargo.lock", "Cargo.toml", "resources/*"] [dependencies] -clap = { version = "=4.3.24", features = ["cargo", "deprecated", "wrap_help"] } -colour = "0.7.0" -once_cell = "1.19.0" +clap = { version = "=4.5.7", features = ["cargo", "wrap_help"] } +colour = "2.1" +once_cell = "1.19" [dev-dependencies] -assert_cmd = "2.0.13" -reqwest = { version = "0.11.24", features = ["blocking"] } -serde_json = "1.0.113" -tempfile = "3.10.0" +assert_cmd = "2.0" +reqwest = { version = "0.12", features = ["blocking"] } +serde_json = "1.0" +tempfile = "3.10" diff --git a/README.md b/README.md index a9e318a..8459bb3 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,15 @@ and run the test: make test ``` +### Reproducibility + +Currently, [cargo](https://github.com/rust-lang/cargo/issues/8140) does not provide cross-platform reproducibility for binary files, including WebAssembly. To work around the issue, we provide `rustc` wrapper, which can be enabled using `--wrapper` option. + +``` +cargo casper my_project --wrapper +``` + + ## License Licensed under the [Apache License Version 2.0](LICENSE). diff --git a/resources/Makefile-wrapper.in b/resources/Makefile-wrapper.in new file mode 100644 index 0000000..2a860bd --- /dev/null +++ b/resources/Makefile-wrapper.in @@ -0,0 +1,35 @@ +export RUSTC_WRAPPER := $(CURDIR)/helper/wrapper + +helper/wrapper: helper/wrapper.rs + rustc --crate-name wrapper --crate-type bin -C opt-level=2 -C strip=symbols --edition=2021 -o $@ $< + +.PHONY: prepare build-contract test clippy check-lint lint clean + +prepare: + cd contract && rustup target add wasm32-unknown-unknown + +build-contract: helper/wrapper + cd contract && cargo build --release --target wasm32-unknown-unknown + wasm-strip contract/target/wasm32-unknown-unknown/release/contract.wasm 2>/dev/null | true + +test: build-contract + mkdir -p tests/wasm + cp contract/target/wasm32-unknown-unknown/release/contract.wasm tests/wasm + cd tests && cargo test + +clippy: + cd contract && cargo clippy --all-targets -- -D warnings + cd tests && cargo clippy --all-targets -- -D warnings + +check-lint: clippy + cd contract && cargo fmt -- --check + cd tests && cargo fmt -- --check + +lint: clippy + cd contract && cargo fmt + cd tests && cargo fmt + +clean: + cd contract && cargo clean + cd tests && cargo clean + rm -rf tests/wasm diff --git a/resources/Makefile.in b/resources/Makefile.in index b497b38..9c7715e 100644 --- a/resources/Makefile.in +++ b/resources/Makefile.in @@ -1,3 +1,5 @@ +.PHONY: prepare build-contract test clippy check-lint lint clean + prepare: cd contract && rustup target add wasm32-unknown-unknown diff --git a/resources/wrapper.rs.in b/resources/wrapper.rs.in new file mode 100644 index 0000000..8f3234e --- /dev/null +++ b/resources/wrapper.rs.in @@ -0,0 +1,77 @@ +use std::{ + env, + io::{stderr, stdout, Write}, + process::Command, +}; + +/// Change `metadata=...` argument to `metadata=file` if file is `Some`. +/// Otherwise output plain `metadata=`. Other arguments are not modified. +fn map_args<'a, I>(file: Option<&'a str>, args: I) -> impl Iterator + 'a +where + I: Iterator + 'a, +{ + args.map(move |arg| { + let metadata = "metadata="; + if arg.starts_with(metadata) { + let mut out = metadata.to_string(); + if let Some(path) = file { + out += path; + } + out + } else { + arg + } + }) +} + +fn main() -> Result<(), Box> { + let mut cargo_home = env::var("CARGO_HOME").expect("env variable `CARGO_HOME` must be set"); + if !cargo_home.ends_with('/') { + cargo_home.push('/'); + } + + // Skip first two arguments, which is this wrapper and command name. + let file = env::args() + .skip(2) + .find_map(move |arg| arg.strip_prefix(&cargo_home).map(ToString::to_string)); + + // Skip first argument, which is this wrapper. + let mut args = env::args().skip(1); + let mut command = Command::new(args.next().unwrap()); + command.args(map_args( + file.as_ref().map(|x| x.as_str()), + args.into_iter(), + )); + let output = command.output()?; + stdout().write_all(&output.stdout)?; + stderr().write_all(&output.stderr)?; + + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::map_args; + + #[test] + fn map_rustc_args() { + let args = [ + "rustc", + "--crate-name", + "counter_v2", + "src/main.rs", + "-C", + "metadata=aee64bf716df0053", + "-C", + "extra-filename=-aee64bf716df0053", + ]; + let new_args = map_args( + Some("src/main.rs"), + args.into_iter().map(ToString::to_string), + ); + assert_eq!( + new_args.skip(5).next(), + Some("metadata=src/main.rs".to_string()) + ); + } +} diff --git a/src/common.rs b/src/common.rs index e68df00..177f673 100644 --- a/src/common.rs +++ b/src/common.rs @@ -27,12 +27,11 @@ casper-types = {{ path = "{0}/types" }} Some(CasperOverrides::GitRepo { url, branch }) => { format!( r#"[patch.crates-io] -casper-contract = {{ git = "{0}", branch = "{1}" }} -casper-engine-test-support = {{ git = "{0}", branch = "{1}" }} -casper-execution-engine = {{ git = "{0}", branch = "{1}" }} -casper-types = {{ git = "{0}", branch = "{1}" }} +casper-contract = {{ git = "{url}", branch = "{branch}" }} +casper-engine-test-support = {{ git = "{url}", branch = "{branch}" }} +casper-execution-engine = {{ git = "{url}", branch = "{branch}" }} +casper-types = {{ git = "{url}", branch = "{branch}" }} "#, - url, branch ) } None => String::new(), @@ -40,16 +39,15 @@ casper-types = {{ git = "{0}", branch = "{1}" }} pub fn print_error_and_exit(msg: &str) -> ! { e_red!("error"); - eprintln!("{}", msg); + eprintln!("{msg}"); process::exit(FAILURE_EXIT_CODE) } pub fn create_dir_all>(path: P) { if let Err(error) = fs::create_dir_all(path.as_ref()) { print_error_and_exit(&format!( - ": failed to create '{}': {}", + ": failed to create '{}': {error}", path.as_ref().display(), - error )); } } @@ -57,17 +55,14 @@ pub fn create_dir_all>(path: P) { pub fn write_file, C: AsRef<[u8]>>(path: P, contents: C) { if let Err(error) = fs::write(path.as_ref(), contents) { print_error_and_exit(&format!( - ": failed to write to '{}': {}", + ": failed to write to '{}': {error}", path.as_ref().display(), - error )); } } #[cfg(test)] pub mod tests { - use std::ops::Deref; - use reqwest::blocking; use serde_json::Value; @@ -92,15 +87,12 @@ pub mod tests { let crate_io_index_contents = blocking::get(url) .unwrap_or_else(|error| { panic!( - "should get index file for {} from GitHub: {}", + "should get index file for {} from GitHub: {error}", dep.name(), - error ) }) .text() - .unwrap_or_else(|error| { - panic!("should parse index file for {}: {}", dep.name(), error) - }); + .unwrap_or_else(|error| panic!("should parse index file for {}: {error}", dep.name())); let latest_entry: Value = serde_json::from_str( crate_io_index_contents @@ -116,32 +108,30 @@ pub mod tests { assert_eq!( latest_publish_version, dep.version(), - "\n\nEnsure local version of {:?} in common.rs is updated to {} as defined in last \ - version of {}{}\n\n", - dep, - latest_publish_version, - CRATES_IO_INDEX_URL_FOR_CASPER_CRATES, + "\n\nEnsure local version of {dep:?} in common.rs is updated to \ + {latest_publish_version} as defined in last version of \ + {CRATES_IO_INDEX_URL_FOR_CASPER_CRATES}{}\n\n", dep.name() ); } #[test] fn check_cl_contract_version() { - check_latest_published_casper_package_version(CL_CONTRACT.deref()); + check_latest_published_casper_package_version(&CL_CONTRACT); } #[test] fn check_cl_types_version() { - check_latest_published_casper_package_version(CL_TYPES.deref()); + check_latest_published_casper_package_version(&CL_TYPES); } #[test] fn check_cl_engine_test_support_version() { - check_latest_published_casper_package_version(CL_ENGINE_TEST_SUPPORT.deref()); + check_latest_published_casper_package_version(&CL_ENGINE_TEST_SUPPORT); } #[test] fn check_cl_execution_engine_version() { - check_latest_published_casper_package_version(CL_EXECUTION_ENGINE.deref()); + check_latest_published_casper_package_version(&CL_EXECUTION_ENGINE); } } diff --git a/src/contract_package.rs b/src/contract_package.rs index b34a464..069fb4e 100644 --- a/src/contract_package.rs +++ b/src/contract_package.rs @@ -21,8 +21,8 @@ static RUST_TOOLCHAIN: Lazy = Lazy::new(|| CONTRACT_PACKAGE_ROOT.join(" static CONTRACT_DEPENDENCIES: Lazy = Lazy::new(|| { format!( "{}{}", - CL_CONTRACT.display_with_features(true, vec![]), - CL_TYPES.display_with_features(true, vec![]), + CL_CONTRACT.display_with_features(true, &[]), + CL_TYPES.display_with_features(true, &[]), ) }); @@ -33,7 +33,7 @@ target = "wasm32-unknown-unknown" static CARGO_TOML_CONTENTS: Lazy = Lazy::new(|| { format!( r#"[package] -name = "{}" +name = "{PACKAGE_NAME}" version = "0.1.0" edition = "2021" @@ -51,7 +51,6 @@ codegen-units = 1 lto = true {}"#, - PACKAGE_NAME, &*CONTRACT_DEPENDENCIES, PACKAGE_NAME.replace('-', "_"), &*PATCH_SECTION @@ -114,11 +113,9 @@ mod tests { { } else { println!( - "skipping 'check_toolchain_version_on_dev' as none of {}, {} and {} are set to {}", - CRON_JOB_BRANCH_NAME_ENV_VAR, - PR_TARGET_BRANCH_NAME_ENV_VAR, - CI_BRANCH_NAME_ENV_VAR, - TEST_BRANCH_NAME, + "skipping 'check_toolchain_version_on_dev' as none of \ + {CRON_JOB_BRANCH_NAME_ENV_VAR}, {PR_TARGET_BRANCH_NAME_ENV_VAR} and \ + {CI_BRANCH_NAME_ENV_VAR} are set to {TEST_BRANCH_NAME}", ); return; } diff --git a/src/dependency.rs b/src/dependency.rs index 60686cd..61e6541 100644 --- a/src/dependency.rs +++ b/src/dependency.rs @@ -9,6 +9,7 @@ pub struct Dependency { } impl Dependency { + #[must_use] pub fn new(name: &str, version: &str) -> Self { Dependency { name: name.to_string(), @@ -16,7 +17,7 @@ impl Dependency { } } - pub fn display_with_features(&self, default_features: bool, features: Vec<&str>) -> String { + pub fn display_with_features(&self, default_features: bool, features: &[&str]) -> String { let version = if ARGS.casper_overrides().is_some() { "*" } else { @@ -24,28 +25,30 @@ impl Dependency { }; if default_features && features.is_empty() { - return format!("{} = \"{}\"\n", self.name, version); + return format!("{} = \"{version}\"\n", self.name); } - let mut output = format!(r#"{} = {{ version = "{}""#, self.name, version); + let mut output = format!(r#"{} = {{ version = "{version}""#, self.name); if !default_features { - output = format!("{}, default-features = false", output); + output = format!("{output}, default-features = false"); } if !features.is_empty() { - output = format!("{}, features = {:?}", output, features); + output = format!("{output}, features = {features:?}"); } - format!("{} }}\n", output) + format!("{output} }}\n") } #[cfg(test)] + #[must_use] pub fn name(&self) -> &str { &self.name } #[cfg(test)] + #[must_use] pub fn version(&self) -> &str { &self.version } diff --git a/src/main.rs b/src/main.rs index 5559e58..678e50d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,39 +1,41 @@ //! Command line tool for creating a Wasm contract and tests for use on the Casper Platform. -#![deny(warnings)] +// #![deny(warnings)] -pub mod common; +mod common; mod contract_package; -pub mod dependency; +mod dependency; mod makefile; mod tests_package; mod travis_yml; +mod wrapper; use std::{ env, path::{Path, PathBuf}, }; -use clap::{builder::ValueParser, crate_description, crate_name, crate_version, Arg, Command}; +use clap::{ + builder::ValueParser, crate_description, crate_name, crate_version, Arg, ArgAction, Command, +}; use once_cell::sync::Lazy; -const USAGE: &str = r#"cargo casper [FLAGS] +const USAGE: &str = r"cargo casper [FLAGS] cd make prepare - make test"#; + make test"; const ROOT_PATH_ARG_NAME: &str = "path"; -const ROOT_PATH_ARG_VALUE_NAME: &str = "path"; const ROOT_PATH_ARG_HELP: &str = "Path to new folder for contract and tests"; const WORKSPACE_PATH_ARG_NAME: &str = "workspace-path"; -const WORKSPACE_PATH_ARG_LONG: &str = "workspace-path"; const GIT_URL_ARG_NAME: &str = "git-url"; -const GIT_URL_LONG: &str = "git-url"; const GIT_BRANCH_ARG_NAME: &str = "git-branch"; -const GIT_BRANCH_LONG: &str = "git-branch"; + +const WRAPPER_ARG_NAME: &str = "wrapper"; +const WRAPPER_ARG_HELP: &str = "Use rustc wrapper to ensure wasm reproducibility"; const FAILURE_EXIT_CODE: i32 = 101; @@ -53,6 +55,7 @@ enum CasperOverrides { struct Args { root_path: PathBuf, casper_overrides: Option, + use_wrapper: bool, } impl Args { @@ -67,7 +70,7 @@ impl Args { // invalid call (the user entered 'cargo casper' with no target dir specified). The latter // case is assumed as being more likely. let filtered_args_iter = env::args().enumerate().filter_map(|(index, value)| { - if index == 1 && value.as_str() == "casper" { + if index == 1 && value == "casper" { None } else { Some(value) @@ -77,21 +80,27 @@ impl Args { let root_path_arg = Arg::new(ROOT_PATH_ARG_NAME) .value_parser(ValueParser::path_buf()) .required(true) - .value_name(ROOT_PATH_ARG_VALUE_NAME) + .value_name(ROOT_PATH_ARG_NAME) .help(ROOT_PATH_ARG_HELP); + let use_wrapper_arg = Arg::new(WRAPPER_ARG_NAME) + .long(WRAPPER_ARG_NAME) + .short('w') + .help(WRAPPER_ARG_HELP) + .action(ArgAction::SetTrue); + let workspace_path_arg = Arg::new(WORKSPACE_PATH_ARG_NAME) - .long(WORKSPACE_PATH_ARG_LONG) + .long(WORKSPACE_PATH_ARG_NAME) .hide(true); let git_url_arg = Arg::new(GIT_URL_ARG_NAME) - .long(GIT_URL_LONG) + .long(GIT_URL_ARG_NAME) .hide(true) .conflicts_with(WORKSPACE_PATH_ARG_NAME) .requires(GIT_BRANCH_ARG_NAME); let git_branch_arg = Arg::new(GIT_BRANCH_ARG_NAME) - .long(GIT_BRANCH_LONG) + .long(GIT_BRANCH_ARG_NAME) .hide(true) .conflicts_with(WORKSPACE_PATH_ARG_NAME) .requires(GIT_URL_ARG_NAME); @@ -101,6 +110,7 @@ impl Args { .about(crate_description!()) .override_usage(USAGE) .arg(root_path_arg) + .arg(use_wrapper_arg) .arg(workspace_path_arg) .arg(git_url_arg) .arg(git_branch_arg) @@ -110,7 +120,7 @@ impl Args { .get_one::(ROOT_PATH_ARG_NAME) .expect("expected path") .clone(); - + let use_wrapper = arg_matches.get_flag(WRAPPER_ARG_NAME); let maybe_workspace_path = arg_matches.get_one::(WORKSPACE_PATH_ARG_NAME); let maybe_git_url = arg_matches.get_one::(GIT_URL_ARG_NAME); let maybe_git_branch = arg_matches.get_one::(GIT_BRANCH_ARG_NAME); @@ -128,6 +138,7 @@ impl Args { Args { root_path, casper_overrides, + use_wrapper, } } @@ -141,16 +152,19 @@ impl Args { } fn main() { - if ARGS.root_path().exists() { + if ARGS.root_path.exists() { common::print_error_and_exit(&format!( ": destination '{}' already exists", - ARGS.root_path().display() + ARGS.root_path.display() )); } - common::create_dir_all(ARGS.root_path()); + common::create_dir_all(&ARGS.root_path); contract_package::create(); tests_package::create(); - makefile::create(); + makefile::create(ARGS.use_wrapper); travis_yml::create(); + if ARGS.use_wrapper { + wrapper::create(); + } } diff --git a/src/makefile.rs b/src/makefile.rs index bf0339c..fc97d26 100644 --- a/src/makefile.rs +++ b/src/makefile.rs @@ -2,7 +2,14 @@ use crate::{common, ARGS}; const FILENAME: &str = "Makefile"; const MAKEFILE_CONTENTS: &str = include_str!("../resources/Makefile.in"); +const MAKEFILE_CONTENTS_WITH_WRAPPER: &str = include_str!("../resources/Makefile-wrapper.in"); -pub fn create() { - common::write_file(ARGS.root_path().join(FILENAME), MAKEFILE_CONTENTS); +pub fn create(use_wrapper: bool) { + let filename = ARGS.root_path().join(FILENAME); + let contents = if use_wrapper { + MAKEFILE_CONTENTS_WITH_WRAPPER + } else { + MAKEFILE_CONTENTS + }; + common::write_file(filename, contents); } diff --git a/src/tests_package.rs b/src/tests_package.rs index 9cd953c..aa58a3c 100644 --- a/src/tests_package.rs +++ b/src/tests_package.rs @@ -22,10 +22,10 @@ static INTEGRATION_TESTS_RS: Lazy = pub static TEST_DEPENDENCIES: Lazy = Lazy::new(|| { format!( "{}{}{}{}", - CL_CONTRACT.display_with_features(false, vec!["test-support"]), - CL_ENGINE_TEST_SUPPORT.display_with_features(true, vec!["test-support"]), - CL_EXECUTION_ENGINE.display_with_features(true, vec![]), - CL_TYPES.display_with_features(true, vec![]) + CL_CONTRACT.display_with_features(false, &["test-support"]), + CL_ENGINE_TEST_SUPPORT.display_with_features(true, &["test-support"]), + CL_EXECUTION_ENGINE.display_with_features(true, &[]), + CL_TYPES.display_with_features(true, &[]) ) }); diff --git a/src/travis_yml.rs b/src/travis_yml.rs index 9b641f3..55f4444 100644 --- a/src/travis_yml.rs +++ b/src/travis_yml.rs @@ -1,12 +1,12 @@ use crate::{common, ARGS}; const FILENAME: &str = ".travis.yml"; -const CONTENTS: &str = r#"language: rust +const CONTENTS: &str = r"language: rust script: - make prepare - make check-lint - make test -"#; +"; pub fn create() { common::write_file(ARGS.root_path().join(FILENAME), CONTENTS); diff --git a/src/wrapper.rs b/src/wrapper.rs new file mode 100644 index 0000000..8ec6ce3 --- /dev/null +++ b/src/wrapper.rs @@ -0,0 +1,11 @@ +use crate::{common, ARGS}; + +const FILENAME: &str = "helper/wrapper.rs"; +const WRAPPER_CONTENTS: &str = include_str!("../resources/wrapper.rs.in"); + +pub fn create() { + let filename = ARGS.root_path().join(FILENAME); + let helper_folder = filename.parent().expect("should have parent"); + common::create_dir_all(helper_folder); + common::write_file(filename, WRAPPER_CONTENTS); +} diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index b17781c..642bbe2 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -24,10 +24,10 @@ fn should_fail_when_target_path_already_exists() { let exit_code = output_error.as_output().unwrap().status.code().unwrap(); assert_eq!(FAILURE_EXIT_CODE, exit_code); - let stderr: String = String::from_utf8_lossy(&output_error.as_output().unwrap().stderr).into(); + let stderr = String::from_utf8_lossy(&output_error.as_output().unwrap().stderr); let expected_msg_fragment = format!(": destination '{}' already exists", test_dir.display()); - assert!(stderr.contains(&expected_msg_fragment)); - assert!(stderr.contains("error")); + assert!(stderr.contains(&expected_msg_fragment), "{}", stderr); + assert!(stderr.contains("error"), "{}", stderr); fs::remove_dir_all(&test_dir).unwrap(); } @@ -122,23 +122,22 @@ fn should_run_cargo_casper_using_published_crates() { Some(branch_name) if branch_name.starts_with("release-") => (), Some(branch_name) => { println!( - "skipping 'should_run_cargo_casper_using_published_crates' as branch name '{}' \ - doesn't start with 'release-'", - branch_name + "skipping 'should_run_cargo_casper_using_published_crates' as branch name \ + '{branch_name}' doesn't start with 'release-'", ); return; } None => { println!( - "skipping 'should_run_cargo_casper_using_published_crates' as {} and {} are unset \ - or set to empty strings", - PR_TARGET_BRANCH_NAME_ENV_VAR, CI_BRANCH_NAME_ENV_VAR + "skipping 'should_run_cargo_casper_using_published_crates' as \ + {PR_TARGET_BRANCH_NAME_ENV_VAR} and {CI_BRANCH_NAME_ENV_VAR} are unset or set to \ + empty strings", ); return; } } - run_make_test_on_generated_project(None) + run_make_test_on_generated_project(None); } /// Checks that running `cargo-casper` with Git overrides yields a generated project which passes @@ -163,9 +162,9 @@ fn should_run_cargo_casper_using_git_overrides() { let branch_selector = env::var(CRON_JOB_BRANCH_NAME_ENV_VAR); let pr_target_branch = env::var(PR_TARGET_BRANCH_NAME_ENV_VAR); let ci_branch = env::var(CI_BRANCH_NAME_ENV_VAR); - println!("{}: {:?}", CRON_JOB_BRANCH_NAME_ENV_VAR, branch_selector); - println!("{}: {:?}", PR_TARGET_BRANCH_NAME_ENV_VAR, pr_target_branch); - println!("{}: {:?}", CI_BRANCH_NAME_ENV_VAR, ci_branch); + println!("{CRON_JOB_BRANCH_NAME_ENV_VAR}: {branch_selector:?}"); + println!("{PR_TARGET_BRANCH_NAME_ENV_VAR}: {pr_target_branch:?}"); + println!("{CI_BRANCH_NAME_ENV_VAR}: {ci_branch:?}"); } let git_branch_arg = match ci_branch_name() { @@ -176,16 +175,16 @@ fn should_run_cargo_casper_using_git_overrides() { ); return; } - Some(branch_name) => format!("--git-branch={}", branch_name), + Some(branch_name) => format!("--git-branch={branch_name}"), None => { println!( - "skipping 'should_run_cargo_casper_using_git_overrides' as {} and {} are unset or \ - set to empty strings", - PR_TARGET_BRANCH_NAME_ENV_VAR, CI_BRANCH_NAME_ENV_VAR + "skipping 'should_run_cargo_casper_using_git_overrides' as \ + {PR_TARGET_BRANCH_NAME_ENV_VAR} and {CI_BRANCH_NAME_ENV_VAR} are unset or set to \ + empty strings", ); return; } }; - run_make_test_on_generated_project(Some(git_branch_arg)) + run_make_test_on_generated_project(Some(git_branch_arg)); }