mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Changed TypeDensity::WhiteSpace to TypeDensity::Wide
Changed eq_str and plus_str assignments to use a match
This commit is contained in:
parent
dba2d8afd5
commit
479b69266b
@ -77,7 +77,7 @@ configuration_option_enum! { TypeDensity:
|
||||
// No spaces around "=" and "+"
|
||||
Compressed,
|
||||
// Spaces around " = " and " + "
|
||||
WhiteSpace,
|
||||
Wide,
|
||||
}
|
||||
|
||||
impl Density {
|
||||
@ -285,7 +285,7 @@ create_config! {
|
||||
fn_args_density: Density, Density::Tall, "Argument density in functions";
|
||||
fn_args_layout: StructLitStyle, StructLitStyle::Visual, "Layout of function arguments";
|
||||
fn_arg_indent: BlockIndentStyle, BlockIndentStyle::Visual, "Indent on function arguments";
|
||||
type_punctuation_density: TypeDensity, TypeDensity::WhiteSpace,
|
||||
type_punctuation_density: TypeDensity, TypeDensity::Wide,
|
||||
"Determines if '+' or '=' are wrapped in spaces in the punctuation of types";
|
||||
// Should we at least try to put the where clause on the same line as the rest of the
|
||||
// function decl?
|
||||
|
16
src/types.rs
16
src/types.rs
@ -425,10 +425,10 @@ impl Rewrite for ast::TyParam {
|
||||
result.push_str(&bounds);
|
||||
}
|
||||
if let Some(ref def) = self.default {
|
||||
let eq_str = if context.config.type_punctuation_density == TypeDensity::Compressed {
|
||||
"="
|
||||
} else {
|
||||
" = "
|
||||
|
||||
let eq_str = match context.config.type_punctuation_density {
|
||||
TypeDensity::Compressed => "=",
|
||||
TypeDensity::Wide => " = ",
|
||||
};
|
||||
result.push_str(eq_str);
|
||||
let budget = try_opt!(width.checked_sub(result.len()));
|
||||
@ -473,11 +473,9 @@ impl Rewrite for ast::Ty {
|
||||
ast::TyObjectSum(ref ty, ref bounds) => {
|
||||
let ty_str = try_opt!(ty.rewrite(context, width, offset));
|
||||
let overhead = ty_str.len() + 3;
|
||||
let plus_str = if context.config.type_punctuation_density ==
|
||||
TypeDensity::Compressed {
|
||||
"+"
|
||||
} else {
|
||||
" + "
|
||||
let plus_str = match context.config.type_punctuation_density {
|
||||
TypeDensity::Compressed => "+",
|
||||
TypeDensity::Wide => " + ",
|
||||
};
|
||||
Some(format!("{}{}{}",
|
||||
ty_str,
|
||||
|
Loading…
Reference in New Issue
Block a user