@@ -19,7 +19,7 @@ use wait_timeout::ChildExt;
19
19
pub fn confirm ( question : & str , default : bool ) -> Result < bool > {
20
20
print ! ( "{} " , question) ;
21
21
let _ = std:: io:: stdout ( ) . flush ( ) ;
22
- let input = try! ( read_line ( ) ) ;
22
+ let input = read_line ( ) ? ;
23
23
24
24
let r = match & * input {
25
25
"y" | "Y" => true ,
@@ -46,7 +46,7 @@ pub fn confirm_advanced() -> Result<Confirm> {
46
46
println ! ( "3) Cancel installation" ) ;
47
47
48
48
let _ = std:: io:: stdout ( ) . flush ( ) ;
49
- let input = try! ( read_line ( ) ) ;
49
+ let input = read_line ( ) ? ;
50
50
51
51
let r = match & * input {
52
52
"1" | "" => Confirm :: Yes ,
@@ -62,7 +62,7 @@ pub fn confirm_advanced() -> Result<Confirm> {
62
62
pub fn question_str ( question : & str , default : & str ) -> Result < String > {
63
63
println ! ( "{}" , question) ;
64
64
let _ = std:: io:: stdout ( ) . flush ( ) ;
65
- let input = try! ( read_line ( ) ) ;
65
+ let input = read_line ( ) ? ;
66
66
67
67
println ! ( "" ) ;
68
68
@@ -77,7 +77,7 @@ pub fn question_bool(question: &str, default: bool) -> Result<bool> {
77
77
println ! ( "{}" , question) ;
78
78
79
79
let _ = std:: io:: stdout ( ) . flush ( ) ;
80
- let input = try! ( read_line ( ) ) ;
80
+ let input = read_line ( ) ? ;
81
81
82
82
println ! ( "" ) ;
83
83
@@ -108,7 +108,7 @@ pub fn set_globals(verbose: bool) -> Result<Cfg> {
108
108
109
109
let download_tracker = RefCell :: new ( DownloadTracker :: new ( ) ) ;
110
110
111
- Ok ( try! ( Cfg :: from_env ( Arc :: new ( move |n : Notification | {
111
+ Ok ( Cfg :: from_env ( Arc :: new ( move |n : Notification | {
112
112
if download_tracker. borrow_mut ( ) . handle_notification ( & n) {
113
113
return ;
114
114
}
@@ -129,7 +129,7 @@ pub fn set_globals(verbose: bool) -> Result<Cfg> {
129
129
err ! ( "{}" , n) ;
130
130
}
131
131
}
132
- } ) ) ) )
132
+ } ) ) ? )
133
133
}
134
134
135
135
pub fn show_channel_update (
@@ -199,26 +199,26 @@ fn show_channel_updates(
199
199
}
200
200
201
201
pub fn update_all_channels ( cfg : & Cfg , self_update : bool , force_update : bool ) -> Result < ( ) > {
202
- let toolchains = try! ( cfg. update_all_channels ( force_update) ) ;
202
+ let toolchains = cfg. update_all_channels ( force_update) ? ;
203
203
204
204
if toolchains. is_empty ( ) {
205
205
info ! ( "no updatable toolchains installed" ) ;
206
206
}
207
207
208
208
let setup_path = if self_update {
209
- try! ( self_update:: prepare_update ( ) )
209
+ self_update:: prepare_update ( ) ?
210
210
} else {
211
211
None
212
212
} ;
213
213
214
214
if !toolchains. is_empty ( ) {
215
215
println ! ( "" ) ;
216
216
217
- try! ( show_channel_updates ( cfg, toolchains) ) ;
217
+ show_channel_updates ( cfg, toolchains) ? ;
218
218
}
219
219
220
220
if let Some ( ref setup_path) = setup_path {
221
- try! ( self_update:: run_update ( setup_path) ) ;
221
+ self_update:: run_update ( setup_path) ? ;
222
222
223
223
unreachable ! ( ) ; // update exits on success
224
224
} else if self_update {
@@ -282,7 +282,7 @@ pub fn rustc_version(toolchain: &Toolchain) -> String {
282
282
283
283
pub fn list_targets ( toolchain : & Toolchain ) -> Result < ( ) > {
284
284
let mut t = term2:: stdout ( ) ;
285
- for component in try! ( toolchain. list_components ( ) ) {
285
+ for component in toolchain. list_components ( ) ? {
286
286
if component. component . pkg == "rust-std" {
287
287
let target = component
288
288
. component
@@ -308,7 +308,7 @@ pub fn list_targets(toolchain: &Toolchain) -> Result<()> {
308
308
309
309
pub fn list_components ( toolchain : & Toolchain ) -> Result < ( ) > {
310
310
let mut t = term2:: stdout ( ) ;
311
- for component in try! ( toolchain. list_components ( ) ) {
311
+ for component in toolchain. list_components ( ) ? {
312
312
let name = component. component . name ( ) ;
313
313
if component. required {
314
314
let _ = t. attr ( term2:: Attr :: Bold ) ;
@@ -327,7 +327,7 @@ pub fn list_components(toolchain: &Toolchain) -> Result<()> {
327
327
}
328
328
329
329
pub fn list_toolchains ( cfg : & Cfg ) -> Result < ( ) > {
330
- let toolchains = try! ( cfg. list_toolchains ( ) ) ;
330
+ let toolchains = cfg. list_toolchains ( ) ? ;
331
331
332
332
if toolchains. is_empty ( ) {
333
333
println ! ( "no installed toolchains" ) ;
@@ -351,7 +351,7 @@ pub fn list_toolchains(cfg: &Cfg) -> Result<()> {
351
351
}
352
352
353
353
pub fn list_overrides ( cfg : & Cfg ) -> Result < ( ) > {
354
- let overrides = try! ( cfg. settings_file . with ( |s| Ok ( s. overrides . clone ( ) ) ) ) ;
354
+ let overrides = cfg. settings_file . with ( |s| Ok ( s. overrides . clone ( ) ) ) ? ;
355
355
356
356
if overrides. is_empty ( ) {
357
357
println ! ( "no overrides" ) ;
0 commit comments