std: Rename {Option,Result}::chain{,_err}* to {and_then,or_else}
This commit is contained in:
parent
e03d60e9eb
commit
38f97ea103
25 changed files with 205 additions and 164 deletions
|
@ -138,7 +138,7 @@ fn config_from_opts(
|
|||
|
||||
let config = default_config(input_crate);
|
||||
let result = result::Ok(config);
|
||||
let result = do result.chain |config| {
|
||||
let result = do result.and_then |config| {
|
||||
let output_dir = getopts::opt_maybe_str(matches, opt_output_dir());
|
||||
let output_dir = output_dir.map_move(|s| Path(s));
|
||||
result::Ok(Config {
|
||||
|
@ -146,10 +146,10 @@ fn config_from_opts(
|
|||
.. config
|
||||
})
|
||||
};
|
||||
let result = do result.chain |config| {
|
||||
let result = do result.and_then |config| {
|
||||
let output_format = getopts::opt_maybe_str(matches, opt_output_format());
|
||||
do output_format.map_move_default(result::Ok(config.clone())) |output_format| {
|
||||
do parse_output_format(output_format).chain |output_format| {
|
||||
do parse_output_format(output_format).and_then |output_format| {
|
||||
result::Ok(Config {
|
||||
output_format: output_format,
|
||||
.. config.clone()
|
||||
|
@ -157,11 +157,11 @@ fn config_from_opts(
|
|||
}
|
||||
}
|
||||
};
|
||||
let result = do result.chain |config| {
|
||||
let result = do result.and_then |config| {
|
||||
let output_style =
|
||||
getopts::opt_maybe_str(matches, opt_output_style());
|
||||
do output_style.map_move_default(result::Ok(config.clone())) |output_style| {
|
||||
do parse_output_style(output_style).chain |output_style| {
|
||||
do parse_output_style(output_style).and_then |output_style| {
|
||||
result::Ok(Config {
|
||||
output_style: output_style,
|
||||
.. config.clone()
|
||||
|
@ -170,11 +170,11 @@ fn config_from_opts(
|
|||
}
|
||||
};
|
||||
let process_output = Cell::new(process_output);
|
||||
let result = do result.chain |config| {
|
||||
let result = do result.and_then |config| {
|
||||
let pandoc_cmd = getopts::opt_maybe_str(matches, opt_pandoc_cmd());
|
||||
let pandoc_cmd = maybe_find_pandoc(
|
||||
&config, pandoc_cmd, process_output.take());
|
||||
do pandoc_cmd.chain |pandoc_cmd| {
|
||||
do pandoc_cmd.and_then |pandoc_cmd| {
|
||||
result::Ok(Config {
|
||||
pandoc_cmd: pandoc_cmd,
|
||||
.. config.clone()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue