File tree Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ extern crate toml;
12
+
13
+ #[ derive( RustcDecodable ) ]
14
+ pub struct Config {
15
+ pub max_width : usize ,
16
+ pub ideal_width : usize ,
17
+ pub leeway : usize ,
18
+ pub tab_spaces : usize ,
19
+ pub newline_style : :: NewlineStyle ,
20
+ pub fn_brace_style : :: BraceStyle ,
21
+ pub fn_return_indent : :: ReturnIndent ,
22
+ }
23
+
24
+ impl Config {
25
+ fn from_toml ( toml : & str ) -> Config {
26
+ println ! ( "About to parse: {}" , toml) ;
27
+ let parsed = toml. parse ( ) . unwrap ( ) ;
28
+ toml:: decode ( parsed) . unwrap ( )
29
+ }
30
+ }
31
+
32
+ pub fn set_config ( toml : & str ) {
33
+ unsafe {
34
+ :: CONFIG = Some ( Config :: from_toml ( toml) ) ;
35
+ }
36
+ }
37
+
38
+ macro_rules! config {
39
+ ( $name: ident) => {
40
+ unsafe { :: CONFIG . as_ref( ) . unwrap( ) . $name }
41
+ } ;
42
+ }
Original file line number Diff line number Diff line change @@ -267,7 +267,6 @@ impl<'a> CompilerCalls<'a> for RustFmtCalls {
267
267
changes. append_newlines ( ) ;
268
268
fmt_lines ( & mut changes) ;
269
269
270
- // FIXME(#5) Should be user specified whether to show or replace.
271
270
let result = changes. write_all_files ( write_mode) ;
272
271
273
272
match result {
You can’t perform that action at this time.
0 commit comments