Skip to content

Commit 5222a25

Browse files
committed
Adjust indentations for Rust code blocks
1 parent 24a13be commit 5222a25

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

modules/contributor/pages/code-style-guide.adoc

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -246,25 +246,25 @@ The usage of `thiserror` is considered invalid.
246246
----
247247
#[derive(thiserror::Error)]
248248
enum Error {
249-
#[error("failed to read config file")]
250-
FileRead(#[from] std::io::Error)
249+
#[error("failed to read config file")]
250+
FileRead(#[from] std::io::Error)
251251
}
252252
253253
fn config_file(user: User) -> Result<(), Error> {
254-
std::fs::read_to_string(user.file_path)?;
254+
std::fs::read_to_string(user.file_path)?;
255255
}
256256
----
257257
258258
[source,rust]
259259
----
260260
#[derive(Snafu)]
261261
enum Error {
262-
#[snafu(context(false))]
263-
FileRead { source: std::io::Error }
262+
#[snafu(context(false))]
263+
FileRead { source: std::io::Error }
264264
}
265265
266266
fn config_file(user: User) -> Result<(), Error> {
267-
std::fs::read_to_string(user.file_path)?;
267+
std::fs::read_to_string(user.file_path)?;
268268
}
269269
----
270270
@@ -277,17 +277,17 @@ fn config_file(user: User) -> Result<(), Error> {
277277
----
278278
#[derive(Snafu)]
279279
enum Error {
280-
#[snafu(display("failed to read config file of user {user_name}"))]
281-
FileRead {
282-
source: std::io::Error,
283-
user_name: String,
284-
}
280+
#[snafu(display("failed to read config file of user {user_name}"))]
281+
FileRead {
282+
source: std::io::Error,
283+
user_name: String,
284+
}
285285
}
286286
287287
fn config_file(user: User) -> Result<(), Error> {
288-
std::fs::read_to_string(user.file_path).context(FileReadSnafu {
289-
user_name: user.name,
290-
});
288+
std::fs::read_to_string(user.file_path).context(FileReadSnafu {
289+
user_name: user.name,
290+
});
291291
}
292292
----
293293
@@ -342,14 +342,14 @@ It is recommended to start the error messages with "failed to..." or "unable to
342342
----
343343
#[derive(Snafu)]
344344
enum Error {
345-
#[snafu(display("Foo happened."))]
346-
Foo,
345+
#[snafu(display("Foo happened."))]
346+
Foo,
347347
348-
#[snafu(display("Bar encountered"))]
349-
Bar,
348+
#[snafu(display("Bar encountered"))]
349+
Bar,
350350
351-
#[snafu(display("arghh baz."))]
352-
Baz,
351+
#[snafu(display("arghh baz."))]
352+
Baz,
353353
}
354354
----
355355
@@ -362,11 +362,11 @@ enum Error {
362362
----
363363
#[derive(Snafu)]
364364
enum Error {
365-
#[snafu(display("failed to foo"))]
366-
Foo,
365+
#[snafu(display("failed to foo"))]
366+
Foo,
367367
368-
#[snafu(display("unable to bar"))]
369-
Bar,
368+
#[snafu(display("unable to bar"))]
369+
Bar,
370370
}
371371
----
372372

0 commit comments

Comments
 (0)