Skip to content

Commit 285f0c6

Browse files
authored
Add a newline after #[cfg(feature = "std")]. (#845)
And add a space before the `{}` in `Error` impls. Instead of this: ```rust #[cfg(feature = "std")]impl std::error::Error for ErrorCode{} ``` Print this: ```rust #[cfg(feature = "std")] impl std::error::Error for ErrorCode {} ``` rustfmt can do this too, but we can be slightly prettier by default.
1 parent 785edc9 commit 285f0c6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/rust/src/interface.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,11 +1031,11 @@ impl InterfaceGenerator<'_> {
10311031
self.push_str("}\n");
10321032
self.push_str("}\n");
10331033
if self.gen.opts.std_feature {
1034-
self.push_str("#[cfg(feature = \"std\")]");
1034+
self.push_str("#[cfg(feature = \"std\")]\n");
10351035
}
10361036
self.push_str("impl std::error::Error for ");
10371037
self.push_str(&name);
1038-
self.push_str("{}\n");
1038+
self.push_str(" {}\n");
10391039
}
10401040
}
10411041
}
@@ -1170,7 +1170,7 @@ impl InterfaceGenerator<'_> {
11701170
self.push_str("\n");
11711171

11721172
if self.gen.opts.std_feature {
1173-
self.push_str("#[cfg(feature = \"std\")]");
1173+
self.push_str("#[cfg(feature = \"std\")]\n");
11741174
}
11751175
self.push_str("impl");
11761176
self.print_generics(lt);
@@ -1361,11 +1361,11 @@ impl InterfaceGenerator<'_> {
13611361
self.push_str("}\n");
13621362
self.push_str("\n");
13631363
if self.gen.opts.std_feature {
1364-
self.push_str("#[cfg(feature = \"std\")]");
1364+
self.push_str("#[cfg(feature = \"std\")]\n");
13651365
}
13661366
self.push_str("impl std::error::Error for ");
13671367
self.push_str(&name);
1368-
self.push_str("{}\n");
1368+
self.push_str(" {}\n");
13691369
} else {
13701370
self.print_rust_enum_debug(
13711371
id,

0 commit comments

Comments
 (0)