deps: Update syntex_syntax to 0.31.0
Most of the churn on this bump comes from the `Visibility` enum changing from pub enum Visibility { Public, Inherited, } to pub enum Visibility { Public, Crate, Restricted { path: P<Path>, id: NodeId }, Inherited, } which require taking `Visibility` by reference in most places. The new variants are not handled at this point. Refs #970
This commit is contained in:
parent
5092eec081
commit
fd38acb86f
5 changed files with 51 additions and 55 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -9,7 +9,7 @@ dependencies = [
|
||||||
"regex 0.1.63 (registry+https://github.com/rust-lang/crates.io-index)",
|
"regex 0.1.63 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"strings 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"strings 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"syntex_syntax 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"syntex_syntax 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"term 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"toml 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
"toml 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicode-segmentation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-segmentation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -111,7 +111,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syntex_syntax"
|
name = "syntex_syntax"
|
||||||
version = "0.30.0"
|
version = "0.31.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -21,7 +21,7 @@ regex = "0.1"
|
||||||
term = "0.4"
|
term = "0.4"
|
||||||
strings = "0.0.1"
|
strings = "0.0.1"
|
||||||
diff = "0.1"
|
diff = "0.1"
|
||||||
syntex_syntax = "0.30"
|
syntex_syntax = "0.31"
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
env_logger = "0.3"
|
env_logger = "0.3"
|
||||||
getopts = "0.2"
|
getopts = "0.2"
|
||||||
|
|
65
src/items.rs
65
src/items.rs
|
@ -126,7 +126,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
// These are not actually rust functions,
|
// These are not actually rust functions,
|
||||||
// but we format them as such.
|
// but we format them as such.
|
||||||
abi::Abi::Rust,
|
abi::Abi::Rust,
|
||||||
item.vis,
|
&item.vis,
|
||||||
span,
|
span,
|
||||||
false,
|
false,
|
||||||
false);
|
false);
|
||||||
|
@ -148,7 +148,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
let prefix = format!("{}static {}{}: ",
|
let prefix = format!("{}static {}{}: ",
|
||||||
format_visibility(item.vis),
|
format_visibility(&item.vis),
|
||||||
mut_str,
|
mut_str,
|
||||||
item.ident);
|
item.ident);
|
||||||
let offset = self.block_indent + prefix.len();
|
let offset = self.block_indent + prefix.len();
|
||||||
|
@ -179,7 +179,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
unsafety: ast::Unsafety,
|
unsafety: ast::Unsafety,
|
||||||
constness: ast::Constness,
|
constness: ast::Constness,
|
||||||
abi: abi::Abi,
|
abi: abi::Abi,
|
||||||
vis: ast::Visibility,
|
vis: &ast::Visibility,
|
||||||
span: Span,
|
span: Span,
|
||||||
block: &ast::Block)
|
block: &ast::Block)
|
||||||
-> Option<String> {
|
-> Option<String> {
|
||||||
|
@ -244,7 +244,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
sig.unsafety,
|
sig.unsafety,
|
||||||
sig.constness,
|
sig.constness,
|
||||||
sig.abi,
|
sig.abi,
|
||||||
ast::Visibility::Inherited,
|
&ast::Visibility::Inherited,
|
||||||
span,
|
span,
|
||||||
false,
|
false,
|
||||||
false));
|
false));
|
||||||
|
@ -303,7 +303,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
|
|
||||||
pub fn visit_enum(&mut self,
|
pub fn visit_enum(&mut self,
|
||||||
ident: ast::Ident,
|
ident: ast::Ident,
|
||||||
vis: ast::Visibility,
|
vis: &ast::Visibility,
|
||||||
enum_def: &ast::EnumDef,
|
enum_def: &ast::EnumDef,
|
||||||
generics: &ast::Generics,
|
generics: &ast::Generics,
|
||||||
span: Span) {
|
span: Span) {
|
||||||
|
@ -414,7 +414,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
format_struct(&context,
|
format_struct(&context,
|
||||||
"",
|
"",
|
||||||
field.node.name,
|
field.node.name,
|
||||||
ast::Visibility::Inherited,
|
&ast::Visibility::Inherited,
|
||||||
&field.node.data,
|
&field.node.data,
|
||||||
None,
|
None,
|
||||||
field.span,
|
field.span,
|
||||||
|
@ -451,7 +451,7 @@ pub fn format_impl(context: &RewriteContext, item: &ast::Item, offset: Indent) -
|
||||||
ref self_ty,
|
ref self_ty,
|
||||||
ref items) = item.node {
|
ref items) = item.node {
|
||||||
let mut result = String::new();
|
let mut result = String::new();
|
||||||
result.push_str(format_visibility(item.vis));
|
result.push_str(format_visibility(&item.vis));
|
||||||
result.push_str(format_unsafety(unsafety));
|
result.push_str(format_unsafety(unsafety));
|
||||||
result.push_str("impl");
|
result.push_str("impl");
|
||||||
|
|
||||||
|
@ -583,7 +583,7 @@ fn is_impl_single_line(context: &RewriteContext,
|
||||||
pub fn format_struct(context: &RewriteContext,
|
pub fn format_struct(context: &RewriteContext,
|
||||||
item_name: &str,
|
item_name: &str,
|
||||||
ident: ast::Ident,
|
ident: ast::Ident,
|
||||||
vis: ast::Visibility,
|
vis: &ast::Visibility,
|
||||||
struct_def: &ast::VariantData,
|
struct_def: &ast::VariantData,
|
||||||
generics: Option<&ast::Generics>,
|
generics: Option<&ast::Generics>,
|
||||||
span: Span,
|
span: Span,
|
||||||
|
@ -619,7 +619,7 @@ pub fn format_trait(context: &RewriteContext, item: &ast::Item, offset: Indent)
|
||||||
item.node {
|
item.node {
|
||||||
let mut result = String::new();
|
let mut result = String::new();
|
||||||
let header = format!("{}{}trait {}",
|
let header = format!("{}{}trait {}",
|
||||||
format_visibility(item.vis),
|
format_visibility(&item.vis),
|
||||||
format_unsafety(unsafety),
|
format_unsafety(unsafety),
|
||||||
item.ident);
|
item.ident);
|
||||||
|
|
||||||
|
@ -741,7 +741,7 @@ pub fn format_trait(context: &RewriteContext, item: &ast::Item, offset: Indent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn format_unit_struct(item_name: &str, ident: ast::Ident, vis: ast::Visibility) -> Option<String> {
|
fn format_unit_struct(item_name: &str, ident: ast::Ident, vis: &ast::Visibility) -> Option<String> {
|
||||||
let mut result = String::with_capacity(1024);
|
let mut result = String::with_capacity(1024);
|
||||||
|
|
||||||
let header_str = format_header(item_name, ident, vis);
|
let header_str = format_header(item_name, ident, vis);
|
||||||
|
@ -754,7 +754,7 @@ fn format_unit_struct(item_name: &str, ident: ast::Ident, vis: ast::Visibility)
|
||||||
fn format_struct_struct(context: &RewriteContext,
|
fn format_struct_struct(context: &RewriteContext,
|
||||||
item_name: &str,
|
item_name: &str,
|
||||||
ident: ast::Ident,
|
ident: ast::Ident,
|
||||||
vis: ast::Visibility,
|
vis: &ast::Visibility,
|
||||||
fields: &[ast::StructField],
|
fields: &[ast::StructField],
|
||||||
generics: Option<&ast::Generics>,
|
generics: Option<&ast::Generics>,
|
||||||
span: Span,
|
span: Span,
|
||||||
|
@ -804,13 +804,13 @@ fn format_struct_struct(context: &RewriteContext,
|
||||||
"}",
|
"}",
|
||||||
|field| {
|
|field| {
|
||||||
// Include attributes and doc comments, if present
|
// Include attributes and doc comments, if present
|
||||||
if !field.node.attrs.is_empty() {
|
if !field.attrs.is_empty() {
|
||||||
field.node.attrs[0].span.lo
|
field.attrs[0].span.lo
|
||||||
} else {
|
} else {
|
||||||
field.span.lo
|
field.span.lo
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|field| field.node.ty.span.hi,
|
|field| field.ty.span.hi,
|
||||||
|field| field.rewrite(context, item_budget, item_indent),
|
|field| field.rewrite(context, item_budget, item_indent),
|
||||||
context.codemap.span_after(span, "{"),
|
context.codemap.span_after(span, "{"),
|
||||||
span.hi);
|
span.hi);
|
||||||
|
@ -835,7 +835,7 @@ fn format_struct_struct(context: &RewriteContext,
|
||||||
fn format_tuple_struct(context: &RewriteContext,
|
fn format_tuple_struct(context: &RewriteContext,
|
||||||
item_name: &str,
|
item_name: &str,
|
||||||
ident: ast::Ident,
|
ident: ast::Ident,
|
||||||
vis: ast::Visibility,
|
vis: &ast::Visibility,
|
||||||
fields: &[ast::StructField],
|
fields: &[ast::StructField],
|
||||||
generics: Option<&ast::Generics>,
|
generics: Option<&ast::Generics>,
|
||||||
span: Span,
|
span: Span,
|
||||||
|
@ -890,13 +890,13 @@ fn format_tuple_struct(context: &RewriteContext,
|
||||||
")",
|
")",
|
||||||
|field| {
|
|field| {
|
||||||
// Include attributes and doc comments, if present
|
// Include attributes and doc comments, if present
|
||||||
if !field.node.attrs.is_empty() {
|
if !field.attrs.is_empty() {
|
||||||
field.node.attrs[0].span.lo
|
field.attrs[0].span.lo
|
||||||
} else {
|
} else {
|
||||||
field.span.lo
|
field.span.lo
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|field| field.node.ty.span.hi,
|
|field| field.ty.span.hi,
|
||||||
|field| field.rewrite(context, item_budget, item_indent),
|
|field| field.rewrite(context, item_budget, item_indent),
|
||||||
context.codemap.span_after(span, "("),
|
context.codemap.span_after(span, "("),
|
||||||
span.hi);
|
span.hi);
|
||||||
|
@ -924,12 +924,12 @@ pub fn rewrite_type_alias(context: &RewriteContext,
|
||||||
ident: ast::Ident,
|
ident: ast::Ident,
|
||||||
ty: &ast::Ty,
|
ty: &ast::Ty,
|
||||||
generics: &ast::Generics,
|
generics: &ast::Generics,
|
||||||
vis: ast::Visibility,
|
vis: &ast::Visibility,
|
||||||
span: Span)
|
span: Span)
|
||||||
-> Option<String> {
|
-> Option<String> {
|
||||||
let mut result = String::new();
|
let mut result = String::new();
|
||||||
|
|
||||||
result.push_str(&format_visibility(vis));
|
result.push_str(&format_visibility(&vis));
|
||||||
result.push_str("type ");
|
result.push_str("type ");
|
||||||
result.push_str(&ident.to_string());
|
result.push_str(&ident.to_string());
|
||||||
|
|
||||||
|
@ -991,21 +991,14 @@ pub fn rewrite_type_alias(context: &RewriteContext,
|
||||||
|
|
||||||
impl Rewrite for ast::StructField {
|
impl Rewrite for ast::StructField {
|
||||||
fn rewrite(&self, context: &RewriteContext, width: usize, offset: Indent) -> Option<String> {
|
fn rewrite(&self, context: &RewriteContext, width: usize, offset: Indent) -> Option<String> {
|
||||||
if contains_skip(&self.node.attrs) {
|
if contains_skip(&self.attrs) {
|
||||||
let span = context.snippet(mk_sp(self.node.attrs[0].span.lo, self.span.hi));
|
let span = context.snippet(mk_sp(self.attrs[0].span.lo, self.span.hi));
|
||||||
return wrap_str(span, context.config.max_width, width, offset);
|
return wrap_str(span, context.config.max_width, width, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
let name = match self.node.kind {
|
let name = self.ident;
|
||||||
ast::StructFieldKind::NamedField(ident, _) => Some(ident.to_string()),
|
let vis = format_visibility(&self.vis);
|
||||||
ast::StructFieldKind::UnnamedField(_) => None,
|
let mut attr_str = try_opt!(self.attrs
|
||||||
};
|
|
||||||
let vis = match self.node.kind {
|
|
||||||
ast::StructFieldKind::NamedField(_, vis) |
|
|
||||||
ast::StructFieldKind::UnnamedField(vis) => format_visibility(vis),
|
|
||||||
};
|
|
||||||
let mut attr_str = try_opt!(self.node
|
|
||||||
.attrs
|
|
||||||
.rewrite(context, context.config.max_width - offset.width(), offset));
|
.rewrite(context, context.config.max_width - offset.width(), offset));
|
||||||
if !attr_str.is_empty() {
|
if !attr_str.is_empty() {
|
||||||
attr_str.push('\n');
|
attr_str.push('\n');
|
||||||
|
@ -1019,13 +1012,13 @@ impl Rewrite for ast::StructField {
|
||||||
|
|
||||||
let last_line_width = last_line_width(&result);
|
let last_line_width = last_line_width(&result);
|
||||||
let budget = try_opt!(width.checked_sub(last_line_width));
|
let budget = try_opt!(width.checked_sub(last_line_width));
|
||||||
let rewrite = try_opt!(self.node.ty.rewrite(context, budget, offset + last_line_width));
|
let rewrite = try_opt!(self.ty.rewrite(context, budget, offset + last_line_width));
|
||||||
Some(result + &rewrite)
|
Some(result + &rewrite)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn rewrite_static(prefix: &str,
|
pub fn rewrite_static(prefix: &str,
|
||||||
vis: ast::Visibility,
|
vis: &ast::Visibility,
|
||||||
ident: ast::Ident,
|
ident: ast::Ident,
|
||||||
ty: &ast::Ty,
|
ty: &ast::Ty,
|
||||||
mutability: ast::Mutability,
|
mutability: ast::Mutability,
|
||||||
|
@ -1239,7 +1232,7 @@ fn rewrite_fn_base(context: &RewriteContext,
|
||||||
unsafety: ast::Unsafety,
|
unsafety: ast::Unsafety,
|
||||||
constness: ast::Constness,
|
constness: ast::Constness,
|
||||||
abi: abi::Abi,
|
abi: abi::Abi,
|
||||||
vis: ast::Visibility,
|
vis: &ast::Visibility,
|
||||||
span: Span,
|
span: Span,
|
||||||
newline_brace: bool,
|
newline_brace: bool,
|
||||||
has_body: bool)
|
has_body: bool)
|
||||||
|
@ -1808,7 +1801,7 @@ fn rewrite_where_clause(context: &RewriteContext,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn format_header(item_name: &str, ident: ast::Ident, vis: ast::Visibility) -> String {
|
fn format_header(item_name: &str, ident: ast::Ident, vis: &ast::Visibility) -> String {
|
||||||
format!("{}{}{}", format_visibility(vis), item_name, ident)
|
format!("{}{}{}", format_visibility(vis), item_name, ident)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,10 +67,13 @@ pub fn extra_offset(text: &str, offset: Indent) -> usize {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn format_visibility(vis: Visibility) -> &'static str {
|
pub fn format_visibility(vis: &Visibility) -> &'static str {
|
||||||
match vis {
|
match *vis {
|
||||||
Visibility::Public => "pub ",
|
Visibility::Public => "pub ",
|
||||||
Visibility::Inherited => "",
|
Visibility::Inherited => "",
|
||||||
|
// TODO(#970): Handle new visibility types.
|
||||||
|
Visibility::Crate => unimplemented!(),
|
||||||
|
Visibility::Restricted { .. } => unimplemented!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
sig.unsafety,
|
sig.unsafety,
|
||||||
sig.constness,
|
sig.constness,
|
||||||
sig.abi,
|
sig.abi,
|
||||||
vis.unwrap_or(ast::Visibility::Inherited),
|
vis.unwrap_or(&ast::Visibility::Inherited),
|
||||||
codemap::mk_sp(s.lo, b.span.lo),
|
codemap::mk_sp(s.lo, b.span.lo),
|
||||||
&b)
|
&b)
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
|
|
||||||
match item.node {
|
match item.node {
|
||||||
ast::ItemKind::Use(ref vp) => {
|
ast::ItemKind::Use(ref vp) => {
|
||||||
self.format_import(item.vis, vp, item.span);
|
self.format_import(&item.vis, vp, item.span);
|
||||||
}
|
}
|
||||||
ast::ItemKind::Impl(..) => {
|
ast::ItemKind::Impl(..) => {
|
||||||
self.format_missing_with_indent(item.span.lo);
|
self.format_missing_with_indent(item.span.lo);
|
||||||
|
@ -229,7 +229,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
::items::format_struct(&context,
|
::items::format_struct(&context,
|
||||||
"struct ",
|
"struct ",
|
||||||
item.ident,
|
item.ident,
|
||||||
item.vis,
|
&item.vis,
|
||||||
def,
|
def,
|
||||||
Some(generics),
|
Some(generics),
|
||||||
item.span,
|
item.span,
|
||||||
|
@ -245,12 +245,12 @@ impl<'a> FmtVisitor<'a> {
|
||||||
}
|
}
|
||||||
ast::ItemKind::Enum(ref def, ref generics) => {
|
ast::ItemKind::Enum(ref def, ref generics) => {
|
||||||
self.format_missing_with_indent(item.span.lo);
|
self.format_missing_with_indent(item.span.lo);
|
||||||
self.visit_enum(item.ident, item.vis, def, generics, item.span);
|
self.visit_enum(item.ident, &item.vis, def, generics, item.span);
|
||||||
self.last_pos = item.span.hi;
|
self.last_pos = item.span.hi;
|
||||||
}
|
}
|
||||||
ast::ItemKind::Mod(ref module) => {
|
ast::ItemKind::Mod(ref module) => {
|
||||||
self.format_missing_with_indent(item.span.lo);
|
self.format_missing_with_indent(item.span.lo);
|
||||||
self.format_mod(module, item.vis, item.span, item.ident);
|
self.format_mod(module, &item.vis, item.span, item.ident);
|
||||||
}
|
}
|
||||||
ast::ItemKind::Mac(ref mac) => {
|
ast::ItemKind::Mac(ref mac) => {
|
||||||
self.format_missing_with_indent(item.span.lo);
|
self.format_missing_with_indent(item.span.lo);
|
||||||
|
@ -262,7 +262,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
}
|
}
|
||||||
ast::ItemKind::Static(ref ty, mutability, ref expr) => {
|
ast::ItemKind::Static(ref ty, mutability, ref expr) => {
|
||||||
let rewrite = rewrite_static("static",
|
let rewrite = rewrite_static("static",
|
||||||
item.vis,
|
&item.vis,
|
||||||
item.ident,
|
item.ident,
|
||||||
ty,
|
ty,
|
||||||
mutability,
|
mutability,
|
||||||
|
@ -272,7 +272,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
}
|
}
|
||||||
ast::ItemKind::Const(ref ty, ref expr) => {
|
ast::ItemKind::Const(ref ty, ref expr) => {
|
||||||
let rewrite = rewrite_static("const",
|
let rewrite = rewrite_static("const",
|
||||||
item.vis,
|
&item.vis,
|
||||||
item.ident,
|
item.ident,
|
||||||
ty,
|
ty,
|
||||||
ast::Mutability::Immutable,
|
ast::Mutability::Immutable,
|
||||||
|
@ -289,7 +289,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
unsafety,
|
unsafety,
|
||||||
constness,
|
constness,
|
||||||
abi,
|
abi,
|
||||||
item.vis),
|
&item.vis),
|
||||||
decl,
|
decl,
|
||||||
body,
|
body,
|
||||||
item.span,
|
item.span,
|
||||||
|
@ -301,7 +301,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
item.ident,
|
item.ident,
|
||||||
ty,
|
ty,
|
||||||
generics,
|
generics,
|
||||||
item.vis,
|
&item.vis,
|
||||||
item.span);
|
item.span);
|
||||||
self.push_rewrite(item.span, rewrite);
|
self.push_rewrite(item.span, rewrite);
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
match ti.node {
|
match ti.node {
|
||||||
ast::TraitItemKind::Const(ref ty, ref expr_opt) => {
|
ast::TraitItemKind::Const(ref ty, ref expr_opt) => {
|
||||||
let rewrite = rewrite_static("const",
|
let rewrite = rewrite_static("const",
|
||||||
ast::Visibility::Inherited,
|
&ast::Visibility::Inherited,
|
||||||
ti.ident,
|
ti.ident,
|
||||||
ty,
|
ty,
|
||||||
ast::Mutability::Immutable,
|
ast::Mutability::Immutable,
|
||||||
|
@ -354,7 +354,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
|
|
||||||
match ii.node {
|
match ii.node {
|
||||||
ast::ImplItemKind::Method(ref sig, ref body) => {
|
ast::ImplItemKind::Method(ref sig, ref body) => {
|
||||||
self.visit_fn(visit::FnKind::Method(ii.ident, sig, Some(ii.vis)),
|
self.visit_fn(visit::FnKind::Method(ii.ident, sig, Some(&ii.vis)),
|
||||||
&sig.decl,
|
&sig.decl,
|
||||||
body,
|
body,
|
||||||
ii.span,
|
ii.span,
|
||||||
|
@ -362,7 +362,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
}
|
}
|
||||||
ast::ImplItemKind::Const(ref ty, ref expr) => {
|
ast::ImplItemKind::Const(ref ty, ref expr) => {
|
||||||
let rewrite = rewrite_static("const",
|
let rewrite = rewrite_static("const",
|
||||||
ii.vis,
|
&ii.vis,
|
||||||
ii.ident,
|
ii.ident,
|
||||||
ty,
|
ty,
|
||||||
ast::Mutability::Immutable,
|
ast::Mutability::Immutable,
|
||||||
|
@ -462,7 +462,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn format_mod(&mut self, m: &ast::Mod, vis: ast::Visibility, s: Span, ident: ast::Ident) {
|
fn format_mod(&mut self, m: &ast::Mod, vis: &ast::Visibility, s: Span, ident: ast::Ident) {
|
||||||
// Decide whether this is an inline mod or an external mod.
|
// Decide whether this is an inline mod or an external mod.
|
||||||
let local_file_name = self.codemap.span_to_filename(s);
|
let local_file_name = self.codemap.span_to_filename(s);
|
||||||
let is_internal = local_file_name == self.codemap.span_to_filename(m.inner);
|
let is_internal = local_file_name == self.codemap.span_to_filename(m.inner);
|
||||||
|
@ -501,7 +501,7 @@ impl<'a> FmtVisitor<'a> {
|
||||||
self.format_missing(filemap.end_pos);
|
self.format_missing(filemap.end_pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn format_import(&mut self, vis: ast::Visibility, vp: &ast::ViewPath, span: Span) {
|
fn format_import(&mut self, vis: &ast::Visibility, vp: &ast::ViewPath, span: Span) {
|
||||||
let vis = utils::format_visibility(vis);
|
let vis = utils::format_visibility(vis);
|
||||||
let mut offset = self.block_indent;
|
let mut offset = self.block_indent;
|
||||||
offset.alignment += vis.len() + "use ".len();
|
offset.alignment += vis.len() + "use ".len();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue