use file_lines::FileLines;
use lists::{ListTactic, SeparatorPlace, SeparatorTactic};
+use Summary;
macro_rules! configuration_option_enum{
($e:ident: $( $x:ident ),+ $(,)*) => {
}
impl Config {
+ pub fn version_meets_requirement(&self, error_summary: &mut Summary) -> bool {
+ if self.was_set().required_version() {
+ let version = env!("CARGO_PKG_VERSION");
+ let required_version = self.required_version();
+ if version != required_version {
+ println!(
+ "Error: rustfmt version ({}) doesn't match the required version ({})",
+ version,
+ required_version,
+ );
+ error_summary.add_formatting_error();
+ return false;
+ }
+ }
+
+ true
+ }
$(
pub fn $i(&self) -> $ty {
the same line with the pattern of arms";
match_block_trailing_comma: bool, false,
"Put a trailing comma after a block based match arm (non-block arms are not affected)";
+ match_arm_forces_newline: bool, false,
+ "Force match arm bodies to be in a new lines";
indent_match_arms: bool, true, "Indent match arms instead of keeping them at the same \
indentation level as the match keyword";
match_pattern_separator_break_point: SeparatorPlace, SeparatorPlace::Back,
Replace, Overwrite, Display, Plain, Diff, Coverage";
condense_wildcard_suffixes: bool, false, "Replace strings of _ wildcards by a single .. in \
tuple patterns";
- combine_control_expr: bool, true, "Combine control expressions with funciton calls.";
+ combine_control_expr: bool, true, "Combine control expressions with function calls.";
struct_field_align_threshold: usize, 0, "Align struct fields if their diffs fits within \
threshold.";
remove_blank_lines_at_start_or_end_of_block: bool, true,
merge_derives: bool, true, "Merge multiple `#[derive(...)]` into a single one";
binop_separator: SeparatorPlace, SeparatorPlace::Front,
"Where to put a binary operator when a binary expression goes multiline.";
+ required_version: String, env!("CARGO_PKG_VERSION").to_owned(),
+ "Require a specific version of rustfmt."
}
#[cfg(test)]