-
Notifications
You must be signed in to change notification settings - Fork 972
Open
Labels
A-matchesArea: match arms, patterns, blocks, etcArea: match arms, patterns, blocks, etcC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEonly-with-optionRequires a non-default option value to reproduceRequires a non-default option value to reproduce
Description
When making the following change from https://github.com/msrd0/gotham_restful/tree/5181b4b448003a06e01d50609371a9578db9d067, rustfmt (rustfmt 1.4.38-nightly (5e57faa 2022-01-19)) needs two passes to correctly format the code:
My Change:
$ git diff src/openapi/router.rs |cat
diff --git a/src/openapi/router.rs b/src/openapi/router.rs
index dbcecb8a5..ec5fdcc21 100644
--- a/src/openapi/router.rs
+++ b/src/openapi/router.rs
@@ -137,8 +137,7 @@ macro_rules! implOpenapiRouter {
Method::PATCH => item.patch = Some(op),
Method::TRACE => item.trace = Some(op),
method => warn!(
- "Ignoring unsupported method '{}' in OpenAPI Specification",
- method
+ "Ignoring unsupported method '{method}' in OpenAPI Specification"
)
};
(self.0).openapi_builder.add_path(path, item);First Pass of rustfmt:
$ git diff src/openapi/router.rs |cat
diff --git a/src/openapi/router.rs b/src/openapi/router.rs
index dbcecb8a5..e81e0640f 100644
--- a/src/openapi/router.rs
+++ b/src/openapi/router.rs
@@ -136,10 +136,9 @@ macro_rules! implOpenapiRouter {
Method::HEAD => item.head = Some(op),
Method::PATCH => item.patch = Some(op),
Method::TRACE => item.trace = Some(op),
- method => warn!(
- "Ignoring unsupported method '{}' in OpenAPI Specification",
- method
- )
+ method => {
+ warn!("Ignoring unsupported method '{method}' in OpenAPI Specification")
+ },
};
(self.0).openapi_builder.add_path(path, item);
Second Pass of rustfmt:
$ git diff src/openapi/router.rs |cat
diff --git a/src/openapi/router.rs b/src/openapi/router.rs
index dbcecb8a5..33937d612 100644
--- a/src/openapi/router.rs
+++ b/src/openapi/router.rs
@@ -136,10 +136,9 @@ macro_rules! implOpenapiRouter {
Method::HEAD => item.head = Some(op),
Method::PATCH => item.patch = Some(op),
Method::TRACE => item.trace = Some(op),
- method => warn!(
- "Ignoring unsupported method '{}' in OpenAPI Specification",
- method
- )
+ method => {
+ warn!("Ignoring unsupported method '{method}' in OpenAPI Specification")
+ }
};
(self.0).openapi_builder.add_path(path, item);
Notice the }, was changed to } in the second pass.
Metadata
Metadata
Assignees
Labels
A-matchesArea: match arms, patterns, blocks, etcArea: match arms, patterns, blocks, etcC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEonly-with-optionRequires a non-default option value to reproduceRequires a non-default option value to reproduce