File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,9 @@ options:
61
61
62
62
fn main( args : [ str ] ) {
63
63
let args = args, binary = vec:: shift ( args) ;
64
+
65
+ if vec:: len ( args) == 0 u { usage ( binary) ; ret; }
66
+
64
67
let match =
65
68
alt getopts:: getopts ( args, opts ( ) ) {
66
69
ok ( m) { m }
Original file line number Diff line number Diff line change @@ -179,9 +179,17 @@ fn doc_header(rd: rustdoc, name: str) {
179
179
* argv[1]: crate file name" ,
180
180
args( argv = "Command-line arguments." )
181
181
) ]
182
+
182
183
fn main ( argv : [ str ] ) {
183
- let sess = @ { cm : codemap :: new_codemap ( ) , mutable next_id : 0 } ;
184
+
184
185
let w = io:: stdout ( ) ;
186
+
187
+ if vec:: len ( argv) != 2 u {
188
+ w. write_str ( #fmt ( "usage: %s <input>\n " , argv[ 0 ] ) ) ;
189
+ ret;
190
+ }
191
+
192
+ let sess = @{ cm: codemap:: new_codemap ( ) , mutable next_id: 0 } ;
185
193
let rd = { ps: pprust:: rust_printer ( w) , w: w } ;
186
194
doc_header ( rd, argv[ 1 ] ) ;
187
195
let p = parser:: parse_crate_from_source_file ( argv[ 1 ] , [ ] , sess) ;
You can’t perform that action at this time.
0 commit comments