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.
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.
13 use {NewlineStyle, BraceStyle, ReturnIndent};
14 use lists::SeparatorTactic;
15 use issues::ReportTactic;
17 #[derive(RustcDecodable)]
20 pub ideal_width: usize,
22 pub tab_spaces: usize,
23 pub newline_style: NewlineStyle,
24 pub fn_brace_style: BraceStyle,
25 pub fn_return_indent: ReturnIndent,
26 pub fn_args_paren_newline: bool,
27 pub struct_trailing_comma: bool,
28 pub struct_lit_trailing_comma: SeparatorTactic,
29 pub enum_trailing_comma: bool,
30 pub report_todo: ReportTactic,
31 pub report_fixme: ReportTactic,
35 fn from_toml(toml: &str) -> Config {
36 let parsed = toml.parse().unwrap();
37 toml::decode(parsed).unwrap()
41 pub fn set_config(toml: &str) {
43 ::CONFIG = Some(Config::from_toml(toml));
49 unsafe { ::CONFIG.as_ref().unwrap().$name }