Skip to content

Commit

Permalink
Merge branch 'master' into feat/literal-suffix-style
Browse files Browse the repository at this point in the history
  • Loading branch information
RedDaedalus authored Apr 8, 2024
2 parents 5097216 + 7289391 commit d76337d
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 134 deletions.
2 changes: 1 addition & 1 deletion ci/check_diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function check_diff() {
)

if [ -z "$diff" ]; then
echo "no diff detected between rustfmt and the feture branch"
echo "no diff detected between rustfmt and the feature branch"
return 0
else
echo "$diff"
Expand Down
102 changes: 0 additions & 102 deletions src/header.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ mod emitter;
mod expr;
mod format_report_formatter;
pub(crate) mod formatting;
pub(crate) mod header;
mod ignore_path;
mod imports;
mod items;
Expand Down
22 changes: 7 additions & 15 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ use crate::comment::{
use crate::config::lists::*;
use crate::config::Version;
use crate::expr::{rewrite_array, rewrite_assign_rhs, RhsAssignKind};
use crate::header::{format_header, HeaderPart};
use crate::lists::{itemize_list, write_list, ListFormatting};
use crate::overflow;
use crate::parse::macros::lazy_static::parse_lazy_static;
Expand All @@ -37,8 +36,8 @@ use crate::shape::{Indent, Shape};
use crate::source_map::SpanUtils;
use crate::spanned::Spanned;
use crate::utils::{
filtered_str_fits, indent_next_line, is_empty_line, mk_sp, remove_trailing_white_spaces,
rewrite_ident, trim_left_preserve_layout, NodeIdExt,
filtered_str_fits, format_visibility, indent_next_line, is_empty_line, mk_sp,
remove_trailing_white_spaces, rewrite_ident, trim_left_preserve_layout, NodeIdExt,
};
use crate::visitor::FmtVisitor;

Expand Down Expand Up @@ -419,21 +418,14 @@ pub(crate) fn rewrite_macro_def(
None => return snippet,
};

let mut header = if def.macro_rules {
let pos = context.snippet_provider.span_after(span, "macro_rules!");
vec![HeaderPart::new("macro_rules!", span.with_hi(pos))]
let mut result = if def.macro_rules {
String::from("macro_rules!")
} else {
let macro_lo = context.snippet_provider.span_before(span, "macro");
let macro_hi = macro_lo + BytePos("macro".len() as u32);
vec![
HeaderPart::visibility(context, vis),
HeaderPart::new("macro", mk_sp(macro_lo, macro_hi)),
]
format!("{}macro", format_visibility(context, vis))
};

header.push(HeaderPart::ident(context, ident));

let mut result = format_header(context, shape, header);
result += " ";
result += rewrite_ident(context, ident);

let multi_branch_style = def.macro_rules || parsed_def.branches.len() != 1;

Expand Down
2 changes: 1 addition & 1 deletion tests/mod-resolver/skip-files-issue-5065/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ mod one;
fn main() {println!("Hello, world!");
}

// trailing commet
// trailing comment
2 changes: 1 addition & 1 deletion tests/source/no_arg_with_commnet.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
fn foo( /* cooment */
fn foo( /* comment */
) {}
12 changes: 0 additions & 12 deletions tests/target/keywords.rs

This file was deleted.

2 changes: 1 addition & 1 deletion tests/target/no_arg_with_commnet.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fn foo(/* cooment */) {}
fn foo(/* comment */) {}

0 comments on commit d76337d

Please sign in to comment.