]> git.lizzy.rs Git - rust.git/blob - src/config.rs
Format comments in struct literals
[rust.git] / src / config.rs
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 use {NewlineStyle, BraceStyle, ReturnIndent};
14 use lists::SeparatorTactic;
15 use issues::ReportTactic;
16
17 #[derive(RustcDecodable, Clone)]
18 pub struct Config {
19     pub max_width: usize,
20     pub ideal_width: usize,
21     pub leeway: 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: SeparatorTactic,
28     pub struct_lit_trailing_comma: SeparatorTactic,
29     pub enum_trailing_comma: bool,
30     pub report_todo: ReportTactic,
31     pub report_fixme: ReportTactic,
32 }
33
34 impl Config {
35     pub fn from_toml(toml: &str) -> Config {
36         let parsed = toml.parse().unwrap();
37         toml::decode(parsed).unwrap()
38     }
39 }