Reformat the source code
This commit is contained in:
3938
parity/cli/mod.rs
3938
parity/cli/mod.rs
File diff suppressed because it is too large
Load Diff
@@ -15,17 +15,24 @@
|
||||
// along with Parity Ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
macro_rules! return_if_parse_error {
|
||||
($e:expr) => (
|
||||
match $e {
|
||||
Err(clap_error @ ClapError { kind: ClapErrorKind::ValueValidation, .. }) => {
|
||||
return Err(clap_error);
|
||||
},
|
||||
($e:expr) => {
|
||||
match $e {
|
||||
Err(
|
||||
clap_error
|
||||
@
|
||||
ClapError {
|
||||
kind: ClapErrorKind::ValueValidation,
|
||||
..
|
||||
},
|
||||
) => {
|
||||
return Err(clap_error);
|
||||
}
|
||||
|
||||
// Otherwise, if $e is ClapErrorKind::ArgumentNotFound or Ok(),
|
||||
// then convert to Option
|
||||
_ => $e.ok()
|
||||
}
|
||||
)
|
||||
// Otherwise, if $e is ClapErrorKind::ArgumentNotFound or Ok(),
|
||||
// then convert to Option
|
||||
_ => $e.ok(),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! if_option {
|
||||
@@ -47,46 +54,46 @@ macro_rules! if_vec {
|
||||
}
|
||||
|
||||
macro_rules! if_option_vec {
|
||||
(Option<Vec<String>>, THEN {$then:expr} ELSE {$otherwise:expr}) => (
|
||||
$then
|
||||
);
|
||||
(Option<$type:ty>, THEN {$then:expr} ELSE {$otherwise:expr}) => (
|
||||
$otherwise
|
||||
);
|
||||
(Option<Vec<String>>, THEN {$then:expr} ELSE {$otherwise:expr}) => {
|
||||
$then
|
||||
};
|
||||
(Option<$type:ty>, THEN {$then:expr} ELSE {$otherwise:expr}) => {
|
||||
$otherwise
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! inner_option_type {
|
||||
(Option<$type:ty>) => (
|
||||
$type
|
||||
)
|
||||
(Option<$type:ty>) => {
|
||||
$type
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! inner_vec_type {
|
||||
(Vec<$type:ty>) => (
|
||||
$type
|
||||
)
|
||||
(Vec<$type:ty>) => {
|
||||
$type
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! inner_option_vec_type {
|
||||
(Option<Vec<String>>) => (
|
||||
String
|
||||
)
|
||||
(Option<Vec<String>>) => {
|
||||
String
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! usage_with_ident {
|
||||
($name:expr, $usage:expr, $help:expr) => (
|
||||
if $usage.contains("<") {
|
||||
format!("<{}> {} '{}'",$name, $usage, $help)
|
||||
} else {
|
||||
format!("[{}] {} '{}'",$name, $usage, $help)
|
||||
}
|
||||
);
|
||||
($name:expr, $usage:expr, $help:expr) => {
|
||||
if $usage.contains("<") {
|
||||
format!("<{}> {} '{}'", $name, $usage, $help)
|
||||
} else {
|
||||
format!("[{}] {} '{}'", $name, $usage, $help)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! underscore_to_hyphen {
|
||||
($e:expr) => (
|
||||
str::replace($e, "_", "-")
|
||||
)
|
||||
($e:expr) => {
|
||||
str::replace($e, "_", "-")
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! usage {
|
||||
|
||||
Reference in New Issue
Block a user