STYLE: extern and use statements rules
This commit is contained in:
parent
9f2447ce94
commit
3ba6682ab3
13
STYLE
13
STYLE
@ -1,6 +1,8 @@
|
|||||||
0. Braces are mandatory for all control flow, as it improves the visibility of
|
0. Braces are mandatory for all control flow, as it improves the visibility of
|
||||||
scope.
|
scope.
|
||||||
|
|
||||||
1. Nested indentation should be kept to a minimum.
|
1. Nested indentation should be kept to a minimum.
|
||||||
|
|
||||||
2. Empty lines should be placed between different kinds of statements:
|
2. Empty lines should be placed between different kinds of statements:
|
||||||
|
|
||||||
int t;
|
int t;
|
||||||
@ -69,6 +71,17 @@
|
|||||||
#include <unistd.h> /* close(2), getopt(3), lseek(2), read(2), write(2),
|
#include <unistd.h> /* close(2), getopt(3), lseek(2), read(2), write(2),
|
||||||
* optarg, optind, STDIN_FILENO, STDOUT_FILENO */
|
* optarg, optind, STDIN_FILENO, STDOUT_FILENO */
|
||||||
|
|
||||||
|
10. In Rust, place extern statements after use statements that include standard
|
||||||
|
library crates. Group alike statements:
|
||||||
|
|
||||||
|
use std::fs::Path;
|
||||||
|
|
||||||
|
extern crate strerror;
|
||||||
|
extern crate sysexits;
|
||||||
|
|
||||||
|
use strerror::StrError;
|
||||||
|
use sysexits::{ EX_OSERR, EX_USAGE };
|
||||||
|
|
||||||
--
|
--
|
||||||
Copyright © 2024 Emma Tebibyte <emma@tebibyte.media>
|
Copyright © 2024 Emma Tebibyte <emma@tebibyte.media>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user