Description
Our CI started failing at the formatting check step after updating to 1.7.0-nightly (9a66e4471 2023-11-19)
; however, when run locally cargo +nightly fmt --check
passes. I verified that they both are using the same version of rustfmt, the only differences being the platform/target.
CI: nightly-x86_64-unknown-linux-gnu installed - rustc 1.76.0-nightly (9a66e4471 2023-11-19)
Local: nightly-aarch64-apple-darwin - Up to date : 1.76.0-nightly (9a66e4471 2023-11-19)
Note that rustfmt 1.7.0-nightly (28317017 2023-11-17)
produces the same output regardless of platform, so I think that the issue only exists in the most recent nightly (rustfmt 1.7.0-nightly (9a66e447 2023-11-19)
) on the nightly-aarch64-apple-darwin
target.
Example
CI Output (nightly-x86_64-unknown-linux-gnu
)
use serde_json::json;
fn main() {
let map = json!({ "key": "value" });
let _value: String = map
.get("key")
.map(|v| v.as_str())
.flatten()
.unwrap_or_default()
.to_string();
}
Local Output (nightly-aarch64-apple-darwin
)
use serde_json::json;
fn main() {
let map = json!({ "key": "value" });
let _value: String =
map.get("key")
.map(|v| v.as_str())
.flatten()
.unwrap_or_default()
.to_string();
}
Output Diff
diff --git a/src/main.rs b/src/main.rs
index 789b018..771d6ca 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -3,10 +3,10 @@ use serde_json::json;
fn main() {
let map = json!({ "key": "value" });
- let _value: String =
- map.get("key")
- .map(|v| v.as_str())
- .flatten()
- .unwrap_or_default()
- .to_string();
+ let _value: String = map
+ .get("key")
+ .map(|v| v.as_str())
+ .flatten()
+ .unwrap_or_default()
+ .to_string();
}