@@ -27,8 +27,12 @@ fn main() {
2727 ' l: loop {
2828 let mut input = String :: new ( ) ;
2929 print ! ( ">> " ) ; // print the prompt
30- io:: stdout ( ) . flush ( ) . unwrap_or_else ( |_| panic ! ( "Failed to flush stdout" ) ) ;
31- io:: stdin ( ) . read_line ( & mut input) . unwrap_or_else ( |_| panic ! ( "Failed to read stdin" ) ) ;
30+ io:: stdout ( )
31+ . flush ( )
32+ . unwrap_or_else ( |_| panic ! ( "Failed to flush stdout" ) ) ;
33+ io:: stdin ( )
34+ . read_line ( & mut input)
35+ . unwrap_or_else ( |_| panic ! ( "Failed to read stdin" ) ) ;
3236 if input. trim ( ) == "exit" {
3337 // if the input is exit, then exit
3438 info ! ( "Exiting..." ) ;
@@ -37,9 +41,13 @@ fn main() {
3741 if Path :: new ( & parsed_args. file ) . exists ( ) && !parsed_args. force {
3842 // if the file exists and we are not forcing it to overwrite
3943 print ! ( "Do you want to overwrite the {}? (y/n): " , parsed_args. file) ; // ask the user if they want to overwrite the file
40- io:: stdout ( ) . flush ( ) . unwrap_or_else ( |_| panic ! ( "Failed to flush stdout" ) ) ;
44+ io:: stdout ( )
45+ . flush ( )
46+ . unwrap_or_else ( |_| panic ! ( "Failed to flush stdout" ) ) ;
4147 let mut y_or_n: String = String :: new ( ) ;
42- io:: stdin ( ) . read_line ( & mut y_or_n) . unwrap_or_else ( |_| panic ! ( "Failed to read stdin" ) ) ; // read the input
48+ io:: stdin ( )
49+ . read_line ( & mut y_or_n)
50+ . unwrap_or_else ( |_| panic ! ( "Failed to read stdin" ) ) ; // read the input
4351 if y_or_n == "n" {
4452 // if the user does not want to overwrite the file exit
4553 exit ( 0 ) ;
@@ -63,11 +71,9 @@ fn main() {
6371 }
6472 } else {
6573 // if we are not in repl mode ie we are reading a file
66- let mut file: File = File :: open ( & parsed_args. file ) . unwrap_or_else (
67- |_| {
68- error:: error ( 0 , "Error encountered while opening file!" ) ;
69- } ,
70- ) ; // open the file
74+ let mut file: File = File :: open ( & parsed_args. file ) . unwrap_or_else ( |_| {
75+ error:: error ( 0 , "Error encountered while opening file!" ) ;
76+ } ) ; // open the file
7177 let mut contents: String = String :: new ( ) ; // create a string to hold the contents of the file
7278 match file. read_to_string ( & mut contents) {
7379 Ok ( contents) => contents,
0 commit comments