commit
580c96bbe3
29 changed files with 49 additions and 49 deletions
|
@ -506,7 +506,7 @@ trait Lorem {
|
||||||
dolor: Dolor,
|
dolor: Dolor,
|
||||||
sit: Sit,
|
sit: Sit,
|
||||||
amet: Amet,
|
amet: Amet,
|
||||||
consectetur: onsectetur,
|
consectetur: Consectetur,
|
||||||
adipiscing: Adipiscing,
|
adipiscing: Adipiscing,
|
||||||
elit: Elit,
|
elit: Elit,
|
||||||
);
|
);
|
||||||
|
@ -516,7 +516,7 @@ trait Lorem {
|
||||||
dolor: Dolor,
|
dolor: Dolor,
|
||||||
sit: Sit,
|
sit: Sit,
|
||||||
amet: Amet,
|
amet: Amet,
|
||||||
consectetur: onsectetur,
|
consectetur: Consectetur,
|
||||||
adipiscing: Adipiscing,
|
adipiscing: Adipiscing,
|
||||||
elit: Elit,
|
elit: Elit,
|
||||||
) {
|
) {
|
||||||
|
@ -569,7 +569,7 @@ trait Lorem {
|
||||||
dolor: Dolor,
|
dolor: Dolor,
|
||||||
sit: Sit,
|
sit: Sit,
|
||||||
amet: Amet,
|
amet: Amet,
|
||||||
consectetur: onsectetur,
|
consectetur: Consectetur,
|
||||||
adipiscing: Adipiscing,
|
adipiscing: Adipiscing,
|
||||||
elit: Elit,
|
elit: Elit,
|
||||||
) {
|
) {
|
||||||
|
@ -598,7 +598,7 @@ trait Lorem {
|
||||||
dolor: Dolor,
|
dolor: Dolor,
|
||||||
sit: Sit,
|
sit: Sit,
|
||||||
amet: Amet,
|
amet: Amet,
|
||||||
consectetur: onsectetur,
|
consectetur: Consectetur,
|
||||||
adipiscing: Adipiscing,
|
adipiscing: Adipiscing,
|
||||||
elit: Elit);
|
elit: Elit);
|
||||||
|
|
||||||
|
@ -606,7 +606,7 @@ trait Lorem {
|
||||||
dolor: Dolor,
|
dolor: Dolor,
|
||||||
sit: Sit,
|
sit: Sit,
|
||||||
amet: Amet,
|
amet: Amet,
|
||||||
consectetur: onsectetur,
|
consectetur: Consectetur,
|
||||||
adipiscing: Adipiscing,
|
adipiscing: Adipiscing,
|
||||||
elit: Elit) {
|
elit: Elit) {
|
||||||
// body
|
// body
|
||||||
|
|
|
@ -151,7 +151,7 @@ for its configuration.
|
||||||
Our visitor keeps track of the desired current indent due to blocks (
|
Our visitor keeps track of the desired current indent due to blocks (
|
||||||
`block_indent`). Each `visit_*` method reformats code according to this indent,
|
`block_indent`). Each `visit_*` method reformats code according to this indent,
|
||||||
`config.comment_width()` and `config.max_width()`. Most reformatting done in the
|
`config.comment_width()` and `config.max_width()`. Most reformatting done in the
|
||||||
`visit_*` methods is a bit hackey and is meant to be temporary until it can be
|
`visit_*` methods is a bit hacky and is meant to be temporary until it can be
|
||||||
done properly.
|
done properly.
|
||||||
|
|
||||||
There are a bunch of methods called `rewrite_*`. There do the bulk of the
|
There are a bunch of methods called `rewrite_*`. There do the bulk of the
|
||||||
|
|
|
@ -128,7 +128,7 @@ are included as out of line modules from `src/lib.rs`.
|
||||||
If `rustfmt` successfully reformatted the code it will exit with `0` exit
|
If `rustfmt` successfully reformatted the code it will exit with `0` exit
|
||||||
status. Exit status `1` signals some unexpected error, like an unknown option or
|
status. Exit status `1` signals some unexpected error, like an unknown option or
|
||||||
a failure to read a file. Exit status `2` is returned if there are syntax errors
|
a failure to read a file. Exit status `2` is returned if there are syntax errors
|
||||||
in the input files. `rustfmt` can't format syntatically invalid code. Finally,
|
in the input files. `rustfmt` can't format syntactically invalid code. Finally,
|
||||||
exit status `3` is returned if there are some issues which can't be resolved
|
exit status `3` is returned if there are some issues which can't be resolved
|
||||||
automatically. For example, if you have a very long comment line `rustfmt`
|
automatically. For example, if you have a very long comment line `rustfmt`
|
||||||
doesn't split it. Instead it prints a warning and exits with `3`.
|
doesn't split it. Instead it prints a warning and exits with `3`.
|
||||||
|
@ -209,7 +209,7 @@ options covering different styles. File an issue, or even better, submit a PR.
|
||||||
* When you run rustfmt, place a file named `rustfmt.toml` or `.rustfmt.toml` in
|
* When you run rustfmt, place a file named `rustfmt.toml` or `.rustfmt.toml` in
|
||||||
target file directory or its parents to override the default settings of
|
target file directory or its parents to override the default settings of
|
||||||
rustfmt. You can generate a file containing the default configuration with
|
rustfmt. You can generate a file containing the default configuration with
|
||||||
`rustfm --dump-default-config rustfmt.toml` and customize as needed.
|
`rustfmt --dump-default-config rustfmt.toml` and customize as needed.
|
||||||
* After successful compilation, a `rustfmt` executable can be found in the
|
* After successful compilation, a `rustfmt` executable can be found in the
|
||||||
target directory.
|
target directory.
|
||||||
* If you're having issues compiling Rustfmt (or compile errors when trying to
|
* If you're having issues compiling Rustfmt (or compile errors when trying to
|
||||||
|
|
|
@ -152,8 +152,8 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) -
|
||||||
}).collect::<Option<Vec<_>>>()?;
|
}).collect::<Option<Vec<_>>>()?;
|
||||||
|
|
||||||
// Total of all items excluding the last.
|
// Total of all items excluding the last.
|
||||||
let extend_last_subexr = last_line_extendable(&parent_rewrite) && rewrites.is_empty();
|
let extend_last_subexpr = last_line_extendable(&parent_rewrite) && rewrites.is_empty();
|
||||||
let almost_total = if extend_last_subexr {
|
let almost_total = if extend_last_subexpr {
|
||||||
last_line_width(&parent_rewrite)
|
last_line_width(&parent_rewrite)
|
||||||
} else {
|
} else {
|
||||||
rewrites.iter().fold(0, |a, b| a + b.len()) + parent_rewrite.len()
|
rewrites.iter().fold(0, |a, b| a + b.len()) + parent_rewrite.len()
|
||||||
|
@ -195,7 +195,7 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) -
|
||||||
// In particular, overflowing is effective when the last child is a method with a multi-lined
|
// In particular, overflowing is effective when the last child is a method with a multi-lined
|
||||||
// block-like argument (e.g. closure):
|
// block-like argument (e.g. closure):
|
||||||
// ```
|
// ```
|
||||||
// parent.child1.chlid2.last_child(|a, b, c| {
|
// parent.child1.child2.last_child(|a, b, c| {
|
||||||
// let x = foo(a, b, c);
|
// let x = foo(a, b, c);
|
||||||
// let y = bar(a, b, c);
|
// let y = bar(a, b, c);
|
||||||
//
|
//
|
||||||
|
@ -208,14 +208,14 @@ pub fn rewrite_chain(expr: &ast::Expr, context: &RewriteContext, shape: Shape) -
|
||||||
// `rewrite_last` rewrites the last child on its own line. We use a closure here instead of
|
// `rewrite_last` rewrites the last child on its own line. We use a closure here instead of
|
||||||
// directly calling `rewrite_chain_subexpr()` to avoid exponential blowup.
|
// directly calling `rewrite_chain_subexpr()` to avoid exponential blowup.
|
||||||
let rewrite_last = || rewrite_chain_subexpr(last_subexpr, total_span, context, last_shape);
|
let rewrite_last = || rewrite_chain_subexpr(last_subexpr, total_span, context, last_shape);
|
||||||
let (last_subexpr_str, fits_single_line) = if all_in_one_line || extend_last_subexr {
|
let (last_subexpr_str, fits_single_line) = if all_in_one_line || extend_last_subexpr {
|
||||||
// First we try to 'overflow' the last child and see if it looks better than using
|
// First we try to 'overflow' the last child and see if it looks better than using
|
||||||
// vertical layout.
|
// vertical layout.
|
||||||
parent_shape.offset_left(almost_total).map(|shape| {
|
parent_shape.offset_left(almost_total).map(|shape| {
|
||||||
if let Some(rw) = rewrite_chain_subexpr(last_subexpr, total_span, context, shape) {
|
if let Some(rw) = rewrite_chain_subexpr(last_subexpr, total_span, context, shape) {
|
||||||
// We allow overflowing here only if both of the following conditions match:
|
// We allow overflowing here only if both of the following conditions match:
|
||||||
// 1. The entire chain fits in a single line expect the last child.
|
// 1. The entire chain fits in a single line expect the last child.
|
||||||
// 2. `last_chlid_str.lines().count() >= 5`.
|
// 2. `last_child_str.lines().count() >= 5`.
|
||||||
let line_count = rw.lines().count();
|
let line_count = rw.lines().count();
|
||||||
let fits_single_line = almost_total + first_line_width(&rw) <= one_line_budget;
|
let fits_single_line = almost_total + first_line_width(&rw) <= one_line_budget;
|
||||||
if fits_single_line && line_count >= 5 {
|
if fits_single_line && line_count >= 5 {
|
||||||
|
|
|
@ -170,7 +170,7 @@ pub fn combine_strs_with_missing_comments(
|
||||||
// We have a missing comment between the first expression and the second expression.
|
// We have a missing comment between the first expression and the second expression.
|
||||||
|
|
||||||
// Peek the the original source code and find out whether there is a newline between the first
|
// Peek the the original source code and find out whether there is a newline between the first
|
||||||
// expression and the second expression or the missing comment. We will preserve the orginal
|
// expression and the second expression or the missing comment. We will preserve the original
|
||||||
// layout whenever possible.
|
// layout whenever possible.
|
||||||
let original_snippet = context.snippet(span);
|
let original_snippet = context.snippet(span);
|
||||||
let prefer_same_line = if let Some(pos) = original_snippet.chars().position(|c| c == '/') {
|
let prefer_same_line = if let Some(pos) = original_snippet.chars().position(|c| c == '/') {
|
||||||
|
|
|
@ -235,7 +235,7 @@ macro_rules! create_config {
|
||||||
|
|
||||||
// Just like the Config struct but with each property wrapped
|
// Just like the Config struct but with each property wrapped
|
||||||
// as Option<T>. This is used to parse a rustfmt.toml that doesn't
|
// as Option<T>. This is used to parse a rustfmt.toml that doesn't
|
||||||
// specity all properties of `Config`.
|
// specify all properties of `Config`.
|
||||||
// We first parse into `PartialConfig`, then create a default `Config`
|
// We first parse into `PartialConfig`, then create a default `Config`
|
||||||
// and overwrite the properties with corresponding values from `PartialConfig`.
|
// and overwrite the properties with corresponding values from `PartialConfig`.
|
||||||
#[derive(Deserialize, Serialize, Clone)]
|
#[derive(Deserialize, Serialize, Clone)]
|
||||||
|
|
|
@ -170,7 +170,7 @@ pub fn format_expr(
|
||||||
ast::ExprKind::TupField(..) |
|
ast::ExprKind::TupField(..) |
|
||||||
ast::ExprKind::MethodCall(..) => rewrite_chain(expr, context, shape),
|
ast::ExprKind::MethodCall(..) => rewrite_chain(expr, context, shape),
|
||||||
ast::ExprKind::Mac(ref mac) => {
|
ast::ExprKind::Mac(ref mac) => {
|
||||||
// Failure to rewrite a marco should not imply failure to
|
// Failure to rewrite a macro should not imply failure to
|
||||||
// rewrite the expression.
|
// rewrite the expression.
|
||||||
rewrite_macro(mac, None, context, shape, MacroPosition::Expression)
|
rewrite_macro(mac, None, context, shape, MacroPosition::Expression)
|
||||||
.or_else(|| Some(context.snippet(expr.span)))
|
.or_else(|| Some(context.snippet(expr.span)))
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// Objects for seeking through a char stream for occurences of TODO and FIXME.
|
// Objects for seeking through a char stream for occurrences of TODO and FIXME.
|
||||||
// Depending on the loaded configuration, may also check that these have an
|
// Depending on the loaded configuration, may also check that these have an
|
||||||
// associated issue number.
|
// associated issue number.
|
||||||
|
|
||||||
|
|
|
@ -572,7 +572,7 @@ where
|
||||||
let comment_end = match self.inner.peek() {
|
let comment_end = match self.inner.peek() {
|
||||||
Some(..) => {
|
Some(..) => {
|
||||||
let mut block_open_index = post_snippet.find("/*");
|
let mut block_open_index = post_snippet.find("/*");
|
||||||
// check if it realy is a block comment (and not //*)
|
// check if it really is a block comment (and not //*)
|
||||||
if let Some(i) = block_open_index {
|
if let Some(i) = block_open_index {
|
||||||
if i > 0 && &post_snippet[i - 1..i] == "/" {
|
if i > 0 && &post_snippet[i - 1..i] == "/" {
|
||||||
block_open_index = None;
|
block_open_index = None;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
// foo!( x, y, z ). The token x may represent an identifier in the code, but we
|
// foo!( x, y, z ). The token x may represent an identifier in the code, but we
|
||||||
// interpreted as an expression.
|
// interpreted as an expression.
|
||||||
// Macro uses which are not-list like, such as bar!(key => val), will not be
|
// Macro uses which are not-list like, such as bar!(key => val), will not be
|
||||||
// reformated.
|
// reformatted.
|
||||||
// List-like invocations with parentheses will be formatted as function calls,
|
// List-like invocations with parentheses will be formatted as function calls,
|
||||||
// and those with brackets will be formatted as array literals.
|
// and those with brackets will be formatted as array literals.
|
||||||
|
|
||||||
|
|
|
@ -118,8 +118,8 @@ impl Rewrite for Pat {
|
||||||
};
|
};
|
||||||
Some(result)
|
Some(result)
|
||||||
}
|
}
|
||||||
PatKind::Struct(ref path, ref fields, elipses) => {
|
PatKind::Struct(ref path, ref fields, ellipsis) => {
|
||||||
rewrite_struct_pat(path, fields, elipses, self.span, context, shape)
|
rewrite_struct_pat(path, fields, ellipsis, self.span, context, shape)
|
||||||
}
|
}
|
||||||
// FIXME(#819) format pattern macros.
|
// FIXME(#819) format pattern macros.
|
||||||
PatKind::Mac(..) => Some(context.snippet(self.span)),
|
PatKind::Mac(..) => Some(context.snippet(self.span)),
|
||||||
|
@ -130,7 +130,7 @@ impl Rewrite for Pat {
|
||||||
fn rewrite_struct_pat(
|
fn rewrite_struct_pat(
|
||||||
path: &ast::Path,
|
path: &ast::Path,
|
||||||
fields: &[codemap::Spanned<ast::FieldPat>],
|
fields: &[codemap::Spanned<ast::FieldPat>],
|
||||||
elipses: bool,
|
ellipsis: bool,
|
||||||
span: Span,
|
span: Span,
|
||||||
context: &RewriteContext,
|
context: &RewriteContext,
|
||||||
shape: Shape,
|
shape: Shape,
|
||||||
|
@ -139,15 +139,15 @@ fn rewrite_struct_pat(
|
||||||
let path_shape = shape.sub_width(2)?;
|
let path_shape = shape.sub_width(2)?;
|
||||||
let path_str = rewrite_path(context, PathContext::Expr, None, path, path_shape)?;
|
let path_str = rewrite_path(context, PathContext::Expr, None, path, path_shape)?;
|
||||||
|
|
||||||
if fields.is_empty() && !elipses {
|
if fields.is_empty() && !ellipsis {
|
||||||
return Some(format!("{} {{}}", path_str));
|
return Some(format!("{} {{}}", path_str));
|
||||||
}
|
}
|
||||||
|
|
||||||
let (elipses_str, terminator) = if elipses { (", ..", "..") } else { ("", "}") };
|
let (ellipsis_str, terminator) = if ellipsis { (", ..", "..") } else { ("", "}") };
|
||||||
|
|
||||||
// 3 = ` { `, 2 = ` }`.
|
// 3 = ` { `, 2 = ` }`.
|
||||||
let (h_shape, v_shape) =
|
let (h_shape, v_shape) =
|
||||||
struct_lit_shape(shape, context, path_str.len() + 3, elipses_str.len() + 2)?;
|
struct_lit_shape(shape, context, path_str.len() + 3, ellipsis_str.len() + 2)?;
|
||||||
|
|
||||||
let items = itemize_list(
|
let items = itemize_list(
|
||||||
context.codemap,
|
context.codemap,
|
||||||
|
@ -169,7 +169,7 @@ fn rewrite_struct_pat(
|
||||||
let mut fields_str = write_list(&item_vec, &fmt)?;
|
let mut fields_str = write_list(&item_vec, &fmt)?;
|
||||||
let one_line_width = h_shape.map_or(0, |shape| shape.width);
|
let one_line_width = h_shape.map_or(0, |shape| shape.width);
|
||||||
|
|
||||||
if elipses {
|
if ellipsis {
|
||||||
if fields_str.contains('\n') || fields_str.len() > one_line_width {
|
if fields_str.contains('\n') || fields_str.len() > one_line_width {
|
||||||
// Add a missing trailing comma.
|
// Add a missing trailing comma.
|
||||||
if fmt.trailing_separator == SeparatorTactic::Never {
|
if fmt.trailing_separator == SeparatorTactic::Never {
|
||||||
|
@ -180,7 +180,7 @@ fn rewrite_struct_pat(
|
||||||
fields_str.push_str("..");
|
fields_str.push_str("..");
|
||||||
} else {
|
} else {
|
||||||
if !fields_str.is_empty() {
|
if !fields_str.is_empty() {
|
||||||
// there are preceeding struct fields being matched on
|
// there are preceding struct fields being matched on
|
||||||
if fmt.tactic == DefinitiveListTactic::Vertical {
|
if fmt.tactic == DefinitiveListTactic::Vertical {
|
||||||
// if the tactic is Vertical, write_list already added a trailing ,
|
// if the tactic is Vertical, write_list already added a trailing ,
|
||||||
fields_str.push_str(" ");
|
fields_str.push_str(" ");
|
||||||
|
|
|
@ -183,7 +183,7 @@ pub fn rewrite_with_alignment<T: AlignedItem>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn struct_field_preix_max_min_width<T: AlignedItem>(
|
fn struct_field_prefix_max_min_width<T: AlignedItem>(
|
||||||
context: &RewriteContext,
|
context: &RewriteContext,
|
||||||
fields: &[T],
|
fields: &[T],
|
||||||
shape: Shape,
|
shape: Shape,
|
||||||
|
@ -219,7 +219,7 @@ fn rewrite_aligned_items_inner<T: AlignedItem>(
|
||||||
// 1 = ","
|
// 1 = ","
|
||||||
let item_shape = Shape::indented(item_indent, context.config).sub_width(1)?;
|
let item_shape = Shape::indented(item_indent, context.config).sub_width(1)?;
|
||||||
let (mut field_prefix_max_width, field_prefix_min_width) =
|
let (mut field_prefix_max_width, field_prefix_min_width) =
|
||||||
struct_field_preix_max_min_width(context, fields, item_shape);
|
struct_field_prefix_max_min_width(context, fields, item_shape);
|
||||||
let max_diff = field_prefix_max_width
|
let max_diff = field_prefix_max_width
|
||||||
.checked_sub(field_prefix_min_width)
|
.checked_sub(field_prefix_min_width)
|
||||||
.unwrap_or(0);
|
.unwrap_or(0);
|
||||||
|
|
|
@ -295,7 +295,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
// complex in the module case. It is complex because the module could be
|
// complex in the module case. It is complex because the module could be
|
||||||
// in a separate file and there might be attributes in both files, but
|
// in a separate file and there might be attributes in both files, but
|
||||||
// the AST lumps them all together.
|
// the AST lumps them all together.
|
||||||
let filterd_attrs;
|
let filtered_attrs;
|
||||||
let mut attrs = &item.attrs;
|
let mut attrs = &item.attrs;
|
||||||
match item.node {
|
match item.node {
|
||||||
ast::ItemKind::Mod(ref m) => {
|
ast::ItemKind::Mod(ref m) => {
|
||||||
|
@ -314,7 +314,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
} else {
|
} else {
|
||||||
// Module is not inline and should not be skipped. We want
|
// Module is not inline and should not be skipped. We want
|
||||||
// to process only the attributes in the current file.
|
// to process only the attributes in the current file.
|
||||||
filterd_attrs = item.attrs
|
filtered_attrs = item.attrs
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|a| {
|
.filter_map(|a| {
|
||||||
let attr_file = self.codemap.lookup_char_pos(a.span.lo()).file;
|
let attr_file = self.codemap.lookup_char_pos(a.span.lo()).file;
|
||||||
|
@ -327,8 +327,8 @@ impl<'a> FmtVisitor<'a> {
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
// Assert because if we should skip it should be caught by
|
// Assert because if we should skip it should be caught by
|
||||||
// the above case.
|
// the above case.
|
||||||
assert!(!self.visit_attrs(&filterd_attrs, ast::AttrStyle::Outer));
|
assert!(!self.visit_attrs(&filtered_attrs, ast::AttrStyle::Outer));
|
||||||
attrs = &filterd_attrs;
|
attrs = &filtered_attrs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => if self.visit_attrs(&item.attrs, ast::AttrStyle::Outer) {
|
_ => if self.visit_attrs(&item.attrs, ast::AttrStyle::Outer) {
|
||||||
|
|
|
@ -159,7 +159,7 @@ pub struct State<F: FnMut() -> ()> { now: F }
|
||||||
|
|
||||||
pub struct State<F: FnMut()> { now: F }
|
pub struct State<F: FnMut()> { now: F }
|
||||||
|
|
||||||
struct Palette { /// A map of indizes in the palette to a count of pixels in approximately that color
|
struct Palette { /// A map of indices in the palette to a count of pixels in approximately that color
|
||||||
foo: i32}
|
foo: i32}
|
||||||
|
|
||||||
// Splitting a single line comment into a block previously had a misalignment
|
// Splitting a single line comment into a block previously had a misalignment
|
||||||
|
|
|
@ -7,7 +7,7 @@ fn op(x: Typ, key : &[u8], upd : Box<Fn(Option<&memcache::Item>) -> (memcache::S
|
||||||
"cool"}
|
"cool"}
|
||||||
|
|
||||||
|
|
||||||
fn weird_comment(/* /*/ double level */ comment */ x: Hello /*/*/* tripple, even */*/*/,
|
fn weird_comment(/* /*/ double level */ comment */ x: Hello /*/*/* triple, even */*/*/,
|
||||||
// Does this work?
|
// Does this work?
|
||||||
y: World
|
y: World
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// rustfmt-fn_args_density: Vertical
|
// rustfmt-fn_args_density: Vertical
|
||||||
|
|
||||||
// Empty list shoul stay on one line.
|
// Empty list should stay on one line.
|
||||||
fn do_bar(
|
fn do_bar(
|
||||||
|
|
||||||
) -> u8 {
|
) -> u8 {
|
||||||
|
|
|
@ -10,7 +10,7 @@ impl Handle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Long function without return type that should not be reformated.
|
// Long function without return type that should not be reformatted.
|
||||||
fn veeeeeeeeeeeeeeeeeeeeery_long_name(a: FirstTypeeeeeeeeee, b: SecondTypeeeeeeeeeeeeeeeeeeeeeee) {}
|
fn veeeeeeeeeeeeeeeeeeeeery_long_name(a: FirstTypeeeeeeeeee, b: SecondTypeeeeeeeeeeeeeeeeeeeeeee) {}
|
||||||
|
|
||||||
fn veeeeeeeeeeeeeeeeeeeeeery_long_name(a: FirstTypeeeeeeeeee, b: SecondTypeeeeeeeeeeeeeeeeeeeeeee) {}
|
fn veeeeeeeeeeeeeeeeeeeeeery_long_name(a: FirstTypeeeeeeeeee, b: SecondTypeeeeeeeeeeeeeeeeeeeeeee) {}
|
||||||
|
|
|
@ -2,7 +2,7 @@ fn issue1468() {
|
||||||
euc_jp_decoder_functions!({
|
euc_jp_decoder_functions!({
|
||||||
let trail_minus_offset = byte.wrapping_sub(0xA1);
|
let trail_minus_offset = byte.wrapping_sub(0xA1);
|
||||||
// Fast-track Hiragana (60% according to Lunde)
|
// Fast-track Hiragana (60% according to Lunde)
|
||||||
// and Katakana (10% acconding to Lunde).
|
// and Katakana (10% according to Lunde).
|
||||||
if jis0208_lead_minus_offset == 0x03 &&
|
if jis0208_lead_minus_offset == 0x03 &&
|
||||||
trail_minus_offset < 0x53 {
|
trail_minus_offset < 0x53 {
|
||||||
// Hiragana
|
// Hiragana
|
||||||
|
|
|
@ -193,7 +193,7 @@ fn issue355() {
|
||||||
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn => println!("a", b),
|
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn => println!("a", b),
|
||||||
// Rewrite splits macro
|
// Rewrite splits macro
|
||||||
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo => vec!(1, 2),
|
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo => vec!(1, 2),
|
||||||
// Macro support fails to recognise this macro as splitable
|
// Macro support fails to recognise this macro as splittable
|
||||||
// We push the whole expr to a new line, TODO split this macro as well
|
// We push the whole expr to a new line, TODO split this macro as well
|
||||||
pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp => vec!(3; 4),
|
pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp => vec!(3; 4),
|
||||||
// q, r and s: Rewrite splits match arm
|
// q, r and s: Rewrite splits match arm
|
||||||
|
|
|
@ -132,7 +132,7 @@ pub struct State<F: FnMut() -> ()> { now: F }
|
||||||
|
|
||||||
pub struct State<F: FnMut()> { now: F }
|
pub struct State<F: FnMut()> { now: F }
|
||||||
|
|
||||||
struct Palette { /// A map of indizes in the palette to a count of pixels in approximately that color
|
struct Palette { /// A map of indices in the palette to a count of pixels in approximately that color
|
||||||
foo: i32}
|
foo: i32}
|
||||||
|
|
||||||
// Splitting a single line comment into a block previously had a misalignment
|
// Splitting a single line comment into a block previously had a misalignment
|
||||||
|
|
|
@ -93,7 +93,7 @@ pub union State<F: FnMut() -> ()> { now: F }
|
||||||
|
|
||||||
pub union State<F: FnMut()> { now: F }
|
pub union State<F: FnMut()> { now: F }
|
||||||
|
|
||||||
union Palette { /// A map of indizes in the palette to a count of pixels in approximately that color
|
union Palette { /// A map of indices in the palette to a count of pixels in approximately that color
|
||||||
foo: i32}
|
foo: i32}
|
||||||
|
|
||||||
// Splitting a single line comment into a block previously had a misalignment
|
// Splitting a single line comment into a block previously had a misalignment
|
||||||
|
|
|
@ -161,7 +161,7 @@ pub struct State<F: FnMut()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Palette {
|
struct Palette {
|
||||||
/// A map of indizes in the palette to a count of pixels in approximately
|
/// A map of indices in the palette to a count of pixels in approximately
|
||||||
/// that color
|
/// that color
|
||||||
foo: i32,
|
foo: i32,
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ fn simple(
|
||||||
|
|
||||||
fn weird_comment(
|
fn weird_comment(
|
||||||
// /*/ double level */ comment
|
// /*/ double level */ comment
|
||||||
x: Hello, // /*/* tripple, even */*/
|
x: Hello, // /*/* triple, even */*/
|
||||||
// Does this work?
|
// Does this work?
|
||||||
y: World,
|
y: World,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// rustfmt-fn_args_density: Vertical
|
// rustfmt-fn_args_density: Vertical
|
||||||
|
|
||||||
// Empty list shoul stay on one line.
|
// Empty list should stay on one line.
|
||||||
fn do_bar() -> u8 {
|
fn do_bar() -> u8 {
|
||||||
bar()
|
bar()
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ impl Handle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Long function without return type that should not be reformated.
|
// Long function without return type that should not be reformatted.
|
||||||
fn veeeeeeeeeeeeeeeeeeeeery_long_name(a: FirstTypeeeeeeeeee, b: SecondTypeeeeeeeeeeeeeeeeeeeeeee) {}
|
fn veeeeeeeeeeeeeeeeeeeeery_long_name(a: FirstTypeeeeeeeeee, b: SecondTypeeeeeeeeeeeeeeeeeeeeeee) {}
|
||||||
|
|
||||||
fn veeeeeeeeeeeeeeeeeeeeeery_long_name(a: FirstTypeeeeeeeeee, b: SecondTypeeeeeeeeeeeeeeeeeeeeeee) {
|
fn veeeeeeeeeeeeeeeeeeeeeery_long_name(a: FirstTypeeeeeeeeee, b: SecondTypeeeeeeeeeeeeeeeeeeeeeee) {
|
||||||
|
|
|
@ -2,7 +2,7 @@ fn issue1468() {
|
||||||
euc_jp_decoder_functions!({
|
euc_jp_decoder_functions!({
|
||||||
let trail_minus_offset = byte.wrapping_sub(0xA1);
|
let trail_minus_offset = byte.wrapping_sub(0xA1);
|
||||||
// Fast-track Hiragana (60% according to Lunde)
|
// Fast-track Hiragana (60% according to Lunde)
|
||||||
// and Katakana (10% acconding to Lunde).
|
// and Katakana (10% according to Lunde).
|
||||||
if jis0208_lead_minus_offset == 0x03 && trail_minus_offset < 0x53 {
|
if jis0208_lead_minus_offset == 0x03 && trail_minus_offset < 0x53 {
|
||||||
// Hiragana
|
// Hiragana
|
||||||
handle.write_upper_bmp(0x3041 + trail_minus_offset as u16)
|
handle.write_upper_bmp(0x3041 + trail_minus_offset as u16)
|
||||||
|
|
|
@ -189,7 +189,7 @@ fn issue355() {
|
||||||
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo => {
|
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo => {
|
||||||
vec![1, 2]
|
vec![1, 2]
|
||||||
}
|
}
|
||||||
// Macro support fails to recognise this macro as splitable
|
// Macro support fails to recognise this macro as splittable
|
||||||
// We push the whole expr to a new line, TODO split this macro as well
|
// We push the whole expr to a new line, TODO split this macro as well
|
||||||
pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp => {
|
pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp => {
|
||||||
vec![3; 4]
|
vec![3; 4]
|
||||||
|
|
|
@ -134,7 +134,7 @@ pub struct State<F: FnMut()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Palette {
|
struct Palette {
|
||||||
/// A map of indizes in the palette to a count of pixels in approximately
|
/// A map of indices in the palette to a count of pixels in approximately
|
||||||
/// that color
|
/// that color
|
||||||
foo: i32,
|
foo: i32,
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ pub union State<F: FnMut()> {
|
||||||
}
|
}
|
||||||
|
|
||||||
union Palette {
|
union Palette {
|
||||||
/// A map of indizes in the palette to a count of pixels in approximately
|
/// A map of indices in the palette to a count of pixels in approximately
|
||||||
/// that color
|
/// that color
|
||||||
foo: i32,
|
foo: i32,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue