Skip to content

Commit

Permalink
Revert "Initial work on formatting headers"
Browse files Browse the repository at this point in the history
This reverts commit dd301b0.
  • Loading branch information
ytmimi authored and calebcartwright committed Apr 7, 2024
1 parent 202fa22 commit f2c84b5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 130 deletions.
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
12 changes: 0 additions & 12 deletions tests/target/keywords.rs

This file was deleted.

0 comments on commit f2c84b5

Please sign in to comment.