getopts: format failure messages with Show.
This obsoletes the old `to_err_msg` method. Replace
println!("Error: {}", failure.to_err_msg())
let string = failure.to_err_msg();
with
println!("Error: {}", failure)
let string = failure.to_str();
[breaking-change]
This commit is contained in:
parent
3851d68a27
commit
0642cbbde0
7 changed files with 28 additions and 21 deletions
|
|
@ -792,7 +792,7 @@ mod test {
|
|||
let matches =
|
||||
&match getopts(["--test".to_string()], optgroups().as_slice()) {
|
||||
Ok(m) => m,
|
||||
Err(f) => fail!("test_switch_implies_cfg_test: {}", f.to_err_msg())
|
||||
Err(f) => fail!("test_switch_implies_cfg_test: {}", f)
|
||||
};
|
||||
let sessopts = build_session_options(matches);
|
||||
let sess = build_session(sessopts, None);
|
||||
|
|
@ -809,8 +809,7 @@ mod test {
|
|||
optgroups().as_slice()) {
|
||||
Ok(m) => m,
|
||||
Err(f) => {
|
||||
fail!("test_switch_implies_cfg_test_unless_cfg_test: {}",
|
||||
f.to_err_msg());
|
||||
fail!("test_switch_implies_cfg_test_unless_cfg_test: {}", f)
|
||||
}
|
||||
};
|
||||
let sessopts = build_session_options(matches);
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ pub fn handle_options(mut args: Vec<String>) -> Option<getopts::Matches> {
|
|||
match getopts::getopts(args.as_slice(), config::optgroups().as_slice()) {
|
||||
Ok(m) => m,
|
||||
Err(f) => {
|
||||
early_error(f.to_err_msg().as_slice());
|
||||
early_error(f.to_str().as_slice());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue