Struct rustfmt_nightly::config::Config

source ·
pub struct Config {
Show 86 fields max_width: (Cell<bool>, bool, usize, bool), hard_tabs: (Cell<bool>, bool, bool, bool), tab_spaces: (Cell<bool>, bool, usize, bool), newline_style: (Cell<bool>, bool, NewlineStyle, bool), indent_style: (Cell<bool>, bool, IndentStyle, bool), use_small_heuristics: (Cell<bool>, bool, Heuristics, bool), width_heuristics: (Cell<bool>, bool, WidthHeuristics, bool), fn_call_width: (Cell<bool>, bool, usize, bool), attr_fn_like_width: (Cell<bool>, bool, usize, bool), struct_lit_width: (Cell<bool>, bool, usize, bool), struct_variant_width: (Cell<bool>, bool, usize, bool), array_width: (Cell<bool>, bool, usize, bool), chain_width: (Cell<bool>, bool, usize, bool), single_line_if_else_max_width: (Cell<bool>, bool, usize, bool), single_line_let_else_max_width: (Cell<bool>, bool, usize, bool), wrap_comments: (Cell<bool>, bool, bool, bool), format_code_in_doc_comments: (Cell<bool>, bool, bool, bool), doc_comment_code_block_width: (Cell<bool>, bool, usize, bool), comment_width: (Cell<bool>, bool, usize, bool), normalize_comments: (Cell<bool>, bool, bool, bool), normalize_doc_attributes: (Cell<bool>, bool, bool, bool), format_strings: (Cell<bool>, bool, bool, bool), format_macro_matchers: (Cell<bool>, bool, bool, bool), format_macro_bodies: (Cell<bool>, bool, bool, bool), skip_macro_invocations: (Cell<bool>, bool, MacroSelectors, bool), hex_literal_case: (Cell<bool>, bool, HexLiteralCase, bool), empty_item_single_line: (Cell<bool>, bool, bool, bool), struct_lit_single_line: (Cell<bool>, bool, bool, bool), fn_single_line: (Cell<bool>, bool, bool, bool), where_single_line: (Cell<bool>, bool, bool, bool), imports_indent: (Cell<bool>, bool, IndentStyle, bool), imports_layout: (Cell<bool>, bool, ListTactic, bool), imports_granularity: (Cell<bool>, bool, ImportGranularity, bool), group_imports: (Cell<bool>, bool, GroupImportsTactic, bool), merge_imports: (Cell<bool>, bool, bool, bool), reorder_imports: (Cell<bool>, bool, bool, bool), reorder_modules: (Cell<bool>, bool, bool, bool), reorder_impl_items: (Cell<bool>, bool, bool, bool), type_punctuation_density: (Cell<bool>, bool, TypeDensity, bool), space_before_colon: (Cell<bool>, bool, bool, bool), space_after_colon: (Cell<bool>, bool, bool, bool), spaces_around_ranges: (Cell<bool>, bool, bool, bool), binop_separator: (Cell<bool>, bool, SeparatorPlace, bool), remove_nested_parens: (Cell<bool>, bool, bool, bool), combine_control_expr: (Cell<bool>, bool, bool, bool), short_array_element_width_threshold: (Cell<bool>, bool, usize, bool), overflow_delimited_expr: (Cell<bool>, bool, bool, bool), struct_field_align_threshold: (Cell<bool>, bool, usize, bool), enum_discrim_align_threshold: (Cell<bool>, bool, usize, bool), match_arm_blocks: (Cell<bool>, bool, bool, bool), match_arm_leading_pipes: (Cell<bool>, bool, MatchArmLeadingPipe, bool), force_multiline_blocks: (Cell<bool>, bool, bool, bool), fn_args_layout: (Cell<bool>, bool, Density, bool), fn_params_layout: (Cell<bool>, bool, Density, bool), brace_style: (Cell<bool>, bool, BraceStyle, bool), control_brace_style: (Cell<bool>, bool, ControlBraceStyle, bool), trailing_semicolon: (Cell<bool>, bool, bool, bool), trailing_comma: (Cell<bool>, bool, SeparatorTactic, bool), match_block_trailing_comma: (Cell<bool>, bool, bool, bool), blank_lines_upper_bound: (Cell<bool>, bool, usize, bool), blank_lines_lower_bound: (Cell<bool>, bool, usize, bool), edition: (Cell<bool>, bool, Edition, bool), version: (Cell<bool>, bool, Version, bool), inline_attribute_width: (Cell<bool>, bool, usize, bool), format_generated_files: (Cell<bool>, bool, bool, bool), generated_marker_line_search_limit: (Cell<bool>, bool, usize, bool), merge_derives: (Cell<bool>, bool, bool, bool), use_try_shorthand: (Cell<bool>, bool, bool, bool), use_field_init_shorthand: (Cell<bool>, bool, bool, bool), force_explicit_abi: (Cell<bool>, bool, bool, bool), condense_wildcard_suffixes: (Cell<bool>, bool, bool, bool), color: (Cell<bool>, bool, Color, bool), required_version: (Cell<bool>, bool, String, bool), unstable_features: (Cell<bool>, bool, bool, bool), disable_all_formatting: (Cell<bool>, bool, bool, bool), skip_children: (Cell<bool>, bool, bool, bool), hide_parse_errors: (Cell<bool>, bool, bool, bool), show_parse_errors: (Cell<bool>, bool, bool, bool), error_on_line_overflow: (Cell<bool>, bool, bool, bool), error_on_unformatted: (Cell<bool>, bool, bool, bool), ignore: (Cell<bool>, bool, IgnoreList, bool), verbose: (Cell<bool>, bool, Verbosity, bool), file_lines: (Cell<bool>, bool, FileLines, bool), emit_mode: (Cell<bool>, bool, EmitMode, bool), make_backup: (Cell<bool>, bool, bool, bool), print_misformatted_file_names: (Cell<bool>, bool, bool, bool),
}

Fields§

§max_width: (Cell<bool>, bool, usize, bool)§hard_tabs: (Cell<bool>, bool, bool, bool)§tab_spaces: (Cell<bool>, bool, usize, bool)§newline_style: (Cell<bool>, bool, NewlineStyle, bool)§indent_style: (Cell<bool>, bool, IndentStyle, bool)§use_small_heuristics: (Cell<bool>, bool, Heuristics, bool)§width_heuristics: (Cell<bool>, bool, WidthHeuristics, bool)§fn_call_width: (Cell<bool>, bool, usize, bool)§attr_fn_like_width: (Cell<bool>, bool, usize, bool)§struct_lit_width: (Cell<bool>, bool, usize, bool)§struct_variant_width: (Cell<bool>, bool, usize, bool)§array_width: (Cell<bool>, bool, usize, bool)§chain_width: (Cell<bool>, bool, usize, bool)§single_line_if_else_max_width: (Cell<bool>, bool, usize, bool)§single_line_let_else_max_width: (Cell<bool>, bool, usize, bool)§wrap_comments: (Cell<bool>, bool, bool, bool)§format_code_in_doc_comments: (Cell<bool>, bool, bool, bool)§doc_comment_code_block_width: (Cell<bool>, bool, usize, bool)§comment_width: (Cell<bool>, bool, usize, bool)§normalize_comments: (Cell<bool>, bool, bool, bool)§normalize_doc_attributes: (Cell<bool>, bool, bool, bool)§format_strings: (Cell<bool>, bool, bool, bool)§format_macro_matchers: (Cell<bool>, bool, bool, bool)§format_macro_bodies: (Cell<bool>, bool, bool, bool)§skip_macro_invocations: (Cell<bool>, bool, MacroSelectors, bool)§hex_literal_case: (Cell<bool>, bool, HexLiteralCase, bool)§empty_item_single_line: (Cell<bool>, bool, bool, bool)§struct_lit_single_line: (Cell<bool>, bool, bool, bool)§fn_single_line: (Cell<bool>, bool, bool, bool)§where_single_line: (Cell<bool>, bool, bool, bool)§imports_indent: (Cell<bool>, bool, IndentStyle, bool)§imports_layout: (Cell<bool>, bool, ListTactic, bool)§imports_granularity: (Cell<bool>, bool, ImportGranularity, bool)§group_imports: (Cell<bool>, bool, GroupImportsTactic, bool)§merge_imports: (Cell<bool>, bool, bool, bool)§reorder_imports: (Cell<bool>, bool, bool, bool)§reorder_modules: (Cell<bool>, bool, bool, bool)§reorder_impl_items: (Cell<bool>, bool, bool, bool)§type_punctuation_density: (Cell<bool>, bool, TypeDensity, bool)§space_before_colon: (Cell<bool>, bool, bool, bool)§space_after_colon: (Cell<bool>, bool, bool, bool)§spaces_around_ranges: (Cell<bool>, bool, bool, bool)§binop_separator: (Cell<bool>, bool, SeparatorPlace, bool)§remove_nested_parens: (Cell<bool>, bool, bool, bool)§combine_control_expr: (Cell<bool>, bool, bool, bool)§short_array_element_width_threshold: (Cell<bool>, bool, usize, bool)§overflow_delimited_expr: (Cell<bool>, bool, bool, bool)§struct_field_align_threshold: (Cell<bool>, bool, usize, bool)§enum_discrim_align_threshold: (Cell<bool>, bool, usize, bool)§match_arm_blocks: (Cell<bool>, bool, bool, bool)§match_arm_leading_pipes: (Cell<bool>, bool, MatchArmLeadingPipe, bool)§force_multiline_blocks: (Cell<bool>, bool, bool, bool)§fn_args_layout: (Cell<bool>, bool, Density, bool)§fn_params_layout: (Cell<bool>, bool, Density, bool)§brace_style: (Cell<bool>, bool, BraceStyle, bool)§control_brace_style: (Cell<bool>, bool, ControlBraceStyle, bool)§trailing_semicolon: (Cell<bool>, bool, bool, bool)§trailing_comma: (Cell<bool>, bool, SeparatorTactic, bool)§match_block_trailing_comma: (Cell<bool>, bool, bool, bool)§blank_lines_upper_bound: (Cell<bool>, bool, usize, bool)§blank_lines_lower_bound: (Cell<bool>, bool, usize, bool)§edition: (Cell<bool>, bool, Edition, bool)§version: (Cell<bool>, bool, Version, bool)§inline_attribute_width: (Cell<bool>, bool, usize, bool)§format_generated_files: (Cell<bool>, bool, bool, bool)§generated_marker_line_search_limit: (Cell<bool>, bool, usize, bool)§merge_derives: (Cell<bool>, bool, bool, bool)§use_try_shorthand: (Cell<bool>, bool, bool, bool)§use_field_init_shorthand: (Cell<bool>, bool, bool, bool)§force_explicit_abi: (Cell<bool>, bool, bool, bool)§condense_wildcard_suffixes: (Cell<bool>, bool, bool, bool)§color: (Cell<bool>, bool, Color, bool)§required_version: (Cell<bool>, bool, String, bool)§unstable_features: (Cell<bool>, bool, bool, bool)§disable_all_formatting: (Cell<bool>, bool, bool, bool)§skip_children: (Cell<bool>, bool, bool, bool)§hide_parse_errors: (Cell<bool>, bool, bool, bool)§show_parse_errors: (Cell<bool>, bool, bool, bool)§error_on_line_overflow: (Cell<bool>, bool, bool, bool)§error_on_unformatted: (Cell<bool>, bool, bool, bool)§ignore: (Cell<bool>, bool, IgnoreList, bool)§verbose: (Cell<bool>, bool, Verbosity, bool)§file_lines: (Cell<bool>, bool, FileLines, bool)§emit_mode: (Cell<bool>, bool, EmitMode, bool)§make_backup: (Cell<bool>, bool, bool, bool)§print_misformatted_file_names: (Cell<bool>, bool, bool, bool)

Implementations§

source§

impl Config

source

pub fn max_width(&self) -> usize

source

pub fn hard_tabs(&self) -> bool

source

pub fn tab_spaces(&self) -> usize

source

pub fn newline_style(&self) -> NewlineStyle

source

pub fn indent_style(&self) -> IndentStyle

source

pub fn use_small_heuristics(&self) -> Heuristics

source

pub fn width_heuristics(&self) -> WidthHeuristics

source

pub fn fn_call_width(&self) -> usize

source

pub fn attr_fn_like_width(&self) -> usize

source

pub fn struct_lit_width(&self) -> usize

source

pub fn struct_variant_width(&self) -> usize

source

pub fn array_width(&self) -> usize

source

pub fn chain_width(&self) -> usize

source

pub fn single_line_if_else_max_width(&self) -> usize

source

pub fn single_line_let_else_max_width(&self) -> usize

source

pub fn wrap_comments(&self) -> bool

source

pub fn format_code_in_doc_comments(&self) -> bool

source

pub fn doc_comment_code_block_width(&self) -> usize

source

pub fn comment_width(&self) -> usize

source

pub fn normalize_comments(&self) -> bool

source

pub fn normalize_doc_attributes(&self) -> bool

source

pub fn format_strings(&self) -> bool

source

pub fn format_macro_matchers(&self) -> bool

source

pub fn format_macro_bodies(&self) -> bool

source

pub fn skip_macro_invocations(&self) -> MacroSelectors

source

pub fn hex_literal_case(&self) -> HexLiteralCase

source

pub fn empty_item_single_line(&self) -> bool

source

pub fn struct_lit_single_line(&self) -> bool

source

pub fn fn_single_line(&self) -> bool

source

pub fn where_single_line(&self) -> bool

source

pub fn imports_indent(&self) -> IndentStyle

source

pub fn imports_layout(&self) -> ListTactic

source

pub fn imports_granularity(&self) -> ImportGranularity

source

pub fn group_imports(&self) -> GroupImportsTactic

source

pub fn merge_imports(&self) -> bool

source

pub fn reorder_imports(&self) -> bool

source

pub fn reorder_modules(&self) -> bool

source

pub fn reorder_impl_items(&self) -> bool

source

pub fn type_punctuation_density(&self) -> TypeDensity

source

pub fn space_before_colon(&self) -> bool

source

pub fn space_after_colon(&self) -> bool

source

pub fn spaces_around_ranges(&self) -> bool

source

pub fn binop_separator(&self) -> SeparatorPlace

source

pub fn remove_nested_parens(&self) -> bool

source

pub fn combine_control_expr(&self) -> bool

source

pub fn short_array_element_width_threshold(&self) -> usize

source

pub fn overflow_delimited_expr(&self) -> bool

source

pub fn struct_field_align_threshold(&self) -> usize

source

pub fn enum_discrim_align_threshold(&self) -> usize

source

pub fn match_arm_blocks(&self) -> bool

source

pub fn match_arm_leading_pipes(&self) -> MatchArmLeadingPipe

source

pub fn force_multiline_blocks(&self) -> bool

source

pub fn fn_args_layout(&self) -> Density

source

pub fn fn_params_layout(&self) -> Density

source

pub fn brace_style(&self) -> BraceStyle

source

pub fn control_brace_style(&self) -> ControlBraceStyle

source

pub fn trailing_semicolon(&self) -> bool

source

pub fn trailing_comma(&self) -> SeparatorTactic

source

pub fn match_block_trailing_comma(&self) -> bool

source

pub fn blank_lines_upper_bound(&self) -> usize

source

pub fn blank_lines_lower_bound(&self) -> usize

source

pub fn edition(&self) -> Edition

source

pub fn version(&self) -> Version

source

pub fn inline_attribute_width(&self) -> usize

source

pub fn format_generated_files(&self) -> bool

source

pub fn generated_marker_line_search_limit(&self) -> usize

source

pub fn merge_derives(&self) -> bool

source

pub fn use_try_shorthand(&self) -> bool

source

pub fn use_field_init_shorthand(&self) -> bool

source

pub fn force_explicit_abi(&self) -> bool

source

pub fn condense_wildcard_suffixes(&self) -> bool

source

pub fn color(&self) -> Color

source

pub fn required_version(&self) -> String

source

pub fn unstable_features(&self) -> bool

source

pub fn disable_all_formatting(&self) -> bool

source

pub fn skip_children(&self) -> bool

source

pub fn hide_parse_errors(&self) -> bool

source

pub fn show_parse_errors(&self) -> bool

source

pub fn error_on_line_overflow(&self) -> bool

source

pub fn error_on_unformatted(&self) -> bool

source

pub fn ignore(&self) -> IgnoreList

source

pub fn verbose(&self) -> Verbosity

source

pub fn file_lines(&self) -> FileLines

source

pub fn emit_mode(&self) -> EmitMode

source

pub fn make_backup(&self) -> bool

source

pub fn print_misformatted_file_names(&self) -> bool

source

pub fn set(&mut self) -> ConfigSetter<'_>

source

pub fn was_set(&self) -> ConfigWasSet<'_>

source

fn fill_from_parsed_config(self, parsed: PartialConfig, dir: &Path) -> Config

source

pub(crate) fn is_valid_name(name: &str) -> bool

source

pub fn is_valid_key_val(key: &str, val: &str) -> bool

source

pub fn used_options(&self) -> PartialConfig

source

pub fn all_options(&self) -> PartialConfig

source

pub fn override_value(&mut self, key: &str, val: &str)

source

pub fn is_hidden_option(name: &str) -> bool

source

pub fn print_docs(out: &mut dyn Write, include_unstable: bool)

source

fn set_width_heuristics(&mut self, heuristics: WidthHeuristics)

source

fn set_heuristics(&mut self)

source

fn set_ignore(&mut self, dir: &Path)

source

fn set_merge_imports(&mut self)

source

fn set_fn_args_layout(&mut self)

source

fn set_hide_parse_errors(&mut self)

source

pub fn is_default(&self, key: &str) -> bool

Returns true if the config key was explicitly set and is the default value.

source§

impl Config

source

pub(crate) fn version_meets_requirement(&self) -> bool

source

pub(crate) fn from_toml_path(file_path: &Path) -> Result<Config, Error>

Constructs a Config from the toml file specified at file_path.

This method only looks at the provided path, for a method that searches parents for a rustfmt.toml see from_resolved_toml_path.

Returns a Config if the config could be read and parsed from the file, otherwise errors.

source

pub(crate) fn from_resolved_toml_path( dir: &Path, ) -> Result<(Config, Option<PathBuf>), Error>

Resolves the config for input in dir.

Searches for rustfmt.toml beginning with dir, and recursively checking parents of dir if no config file is found. If no config file exists in dir or in any parent, a default Config will be returned (and the returned path will be empty).

Returns the Config to use, and the path of the project file if there was one.

source

pub(crate) fn from_toml(toml: &str, dir: &Path) -> Result<Config, String>

Trait Implementations§

source§

impl Clone for Config

source§

fn clone(&self) -> Config

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for Config

source§

fn default() -> Config

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Freeze for Config

§

impl !RefUnwindSafe for Config

§

impl Send for Config

§

impl !Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 848 bytes