Skip to content

Commit

Permalink
prettyplease: expose more entrypoints
Browse files Browse the repository at this point in the history
upstream does not seem interested in making changes along these lines; see dtolnay/prettyplease#5
  • Loading branch information
fw-immunant committed Mar 31, 2022
1 parent 3b9c0db commit 793b799
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion prettyplease/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl Printer {
}
}

fn attr(&mut self, attr: &Attribute) {
pub fn attr(&mut self, attr: &Attribute) {
if let Some(doc) = value_of_attribute("doc", attr) {
if doc.contains('\n') {
self.word(match attr.style {
Expand Down
2 changes: 1 addition & 1 deletion prettyplease/src/generics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl Printer {
self.word(">");
}

fn generic_param(&mut self, generic_param: &GenericParam) {
pub fn generic_param(&mut self, generic_param: &GenericParam) {
match generic_param {
GenericParam::Type(type_param) => self.type_param(type_param),
GenericParam::Lifetime(lifetime_def) => self.lifetime_def(lifetime_def),
Expand Down
8 changes: 4 additions & 4 deletions prettyplease/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ impl Printer {
}
}

fn foreign_item(&mut self, foreign_item: &ForeignItem) {
pub fn foreign_item(&mut self, foreign_item: &ForeignItem) {
match foreign_item {
ForeignItem::Fn(item) => self.foreign_item_fn(item),
ForeignItem::Static(item) => self.foreign_item_static(item),
Expand Down Expand Up @@ -482,7 +482,7 @@ impl Printer {
unimplemented!("ForeignItem::Verbatim `{}`", foreign_item);
}

fn trait_item(&mut self, trait_item: &TraitItem) {
pub fn trait_item(&mut self, trait_item: &TraitItem) {
match trait_item {
TraitItem::Const(item) => self.trait_item_const(item),
TraitItem::Method(item) => self.trait_item_method(item),
Expand Down Expand Up @@ -573,7 +573,7 @@ impl Printer {
unimplemented!("TraitItem::Verbatim `{}`", trait_item);
}

fn impl_item(&mut self, impl_item: &ImplItem) {
pub fn impl_item(&mut self, impl_item: &ImplItem) {
match impl_item {
ImplItem::Const(item) => self.impl_item_const(item),
ImplItem::Method(item) => self.impl_item_method(item),
Expand Down Expand Up @@ -667,7 +667,7 @@ impl Printer {
unimplemented!("ImplItem::Verbatim `{}`", impl_item);
}

fn maybe_variadic(&mut self, arg: &FnArg) -> bool {
pub fn maybe_variadic(&mut self, arg: &FnArg) -> bool {
let pat_type = match arg {
FnArg::Typed(pat_type) => pat_type,
FnArg::Receiver(receiver) => {
Expand Down
2 changes: 1 addition & 1 deletion prettyplease/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ mod stmt;
mod token;
mod ty;

use crate::algorithm::Printer;
pub use crate::algorithm::Printer;
use syn::File;

// Target line width.
Expand Down
2 changes: 1 addition & 1 deletion prettyplease/src/mac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl Printer {
self.word("}");
}

fn macro_rules_tokens(&mut self, stream: TokenStream, matcher: bool) {
pub fn macro_rules_tokens(&mut self, stream: TokenStream, matcher: bool) {
#[derive(PartialEq)]
enum State {
Start,
Expand Down

0 comments on commit 793b799

Please sign in to comment.