Fix compile errors from breaking changes
This commit is contained in:
parent
dd3e1d751f
commit
cc2afeca9e
@ -31,6 +31,7 @@
|
||||
// statement without needing a semi-colon), then adding or removing braces
|
||||
// can change whether it is treated as an expression or statement.
|
||||
|
||||
// FIXME(topecongiro) Format async closures (#2813).
|
||||
pub fn rewrite_closure(
|
||||
capture: ast::CaptureBy,
|
||||
movability: ast::Movability,
|
||||
@ -288,7 +289,7 @@ pub fn rewrite_last_closure(
|
||||
expr: &ast::Expr,
|
||||
shape: Shape,
|
||||
) -> Option<String> {
|
||||
if let ast::ExprKind::Closure(capture, movability, ref fn_decl, ref body, _) = expr.node {
|
||||
if let ast::ExprKind::Closure(capture, _, movability, ref fn_decl, ref body, _) = expr.node {
|
||||
let body = match body.node {
|
||||
ast::ExprKind::Block(ref block, _)
|
||||
if !is_unsafe_block(block)
|
||||
|
@ -183,7 +183,7 @@ pub fn format_expr(
|
||||
} else {
|
||||
Some("yield".to_string())
|
||||
},
|
||||
ast::ExprKind::Closure(capture, movability, ref fn_decl, ref body, _) => {
|
||||
ast::ExprKind::Closure(capture, _, movability, ref fn_decl, ref body, _) => {
|
||||
closures::rewrite_closure(
|
||||
capture, movability, fn_decl, body, expr.span, context, shape,
|
||||
)
|
||||
@ -344,6 +344,8 @@ fn needs_space_after_range(rhs: &ast::Expr) -> bool {
|
||||
}
|
||||
// FIXME(#2743)
|
||||
ast::ExprKind::ObsoleteInPlace(..) => unimplemented!(),
|
||||
// FIXME(topecongiro) Format async block.
|
||||
ast::ExprKind::Async(..) => None,
|
||||
};
|
||||
|
||||
expr_rw
|
||||
|
14
src/items.rs
14
src/items.rs
@ -192,10 +192,10 @@ pub fn from_method_sig(
|
||||
generics: &'a ast::Generics,
|
||||
) -> FnSig<'a> {
|
||||
FnSig {
|
||||
unsafety: method_sig.unsafety,
|
||||
constness: method_sig.constness.node,
|
||||
unsafety: method_sig.header.unsafety,
|
||||
constness: method_sig.header.constness.node,
|
||||
defaultness: ast::Defaultness::Final,
|
||||
abi: method_sig.abi,
|
||||
abi: method_sig.header.abi,
|
||||
decl: &*method_sig.decl,
|
||||
generics,
|
||||
visibility: DEFAULT_VISIBILITY,
|
||||
@ -209,13 +209,13 @@ pub fn from_fn_kind(
|
||||
defaultness: ast::Defaultness,
|
||||
) -> FnSig<'a> {
|
||||
match *fn_kind {
|
||||
visit::FnKind::ItemFn(_, unsafety, constness, abi, visibility, _) => FnSig {
|
||||
visit::FnKind::ItemFn(_, fn_header, visibility, _) => FnSig {
|
||||
decl,
|
||||
generics,
|
||||
abi,
|
||||
constness: constness.node,
|
||||
abi: fn_header.abi,
|
||||
constness: fn_header.constness.node,
|
||||
defaultness,
|
||||
unsafety,
|
||||
unsafety: fn_header.unsafety,
|
||||
visibility: visibility.clone(),
|
||||
},
|
||||
visit::FnKind::Method(_, method_sig, vis, _) => {
|
||||
|
@ -252,6 +252,7 @@ fn close_block(&mut self, unindent_comment: bool) {
|
||||
|
||||
// Note that this only gets called for function definitions. Required methods
|
||||
// on traits do not get handled here.
|
||||
// FIXME(topecongiro) Format async fn (#2812).
|
||||
fn visit_fn(
|
||||
&mut self,
|
||||
fk: visit::FnKind,
|
||||
@ -264,7 +265,7 @@ fn visit_fn(
|
||||
let indent = self.block_indent;
|
||||
let block;
|
||||
let rewrite = match fk {
|
||||
visit::FnKind::ItemFn(ident, _, _, _, _, b) | visit::FnKind::Method(ident, _, _, b) => {
|
||||
visit::FnKind::ItemFn(ident, _, _, b) | visit::FnKind::Method(ident, _, _, b) => {
|
||||
block = b;
|
||||
self.rewrite_fn(
|
||||
indent,
|
||||
@ -392,10 +393,10 @@ pub fn visit_item(&mut self, item: &ast::Item) {
|
||||
ast::ItemKind::Static(..) | ast::ItemKind::Const(..) => {
|
||||
self.visit_static(&StaticParts::from_item(item));
|
||||
}
|
||||
ast::ItemKind::Fn(ref decl, unsafety, constness, abi, ref generics, ref body) => {
|
||||
ast::ItemKind::Fn(ref decl, fn_header, ref generics, ref body) => {
|
||||
let inner_attrs = inner_attributes(&item.attrs);
|
||||
self.visit_fn(
|
||||
visit::FnKind::ItemFn(item.ident, unsafety, constness, abi, &item.vis, body),
|
||||
visit::FnKind::ItemFn(item.ident, fn_header, &item.vis, body),
|
||||
generics,
|
||||
decl,
|
||||
item.span,
|
||||
|
Loading…
Reference in New Issue
Block a user