diff --git a/src/config/config_type.rs b/src/config/config_type.rs index 291a59e1055ee..419cd06436ffa 100644 --- a/src/config/config_type.rs +++ b/src/config/config_type.rs @@ -243,7 +243,7 @@ macro_rules! create_config { if !err.is_empty() { eprint!("{}", err); } - Ok(Config::default().fill_from_parsed_config(parsed_config, dir: &Path)) + Ok(Config::default().fill_from_parsed_config(parsed_config, dir)) } Err(e) => { err.push_str("Error: Decoding config file failed:\n"); diff --git a/src/imports.rs b/src/imports.rs index f4751eb117b11..e7817c175b4e8 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -925,19 +925,23 @@ mod test { parser.parse_in_list() } - macro parse_use_trees($($s:expr),* $(,)*) { - vec![ - $(parse_use_tree($s),)* - ] + macro_rules! parse_use_trees { + ($($s:expr),* $(,)*) => { + vec![ + $(parse_use_tree($s),)* + ] + } } #[test] fn test_use_tree_merge() { - macro test_merge([$($input:expr),* $(,)*], [$($output:expr),* $(,)*]) { - assert_eq!( - merge_use_trees(parse_use_trees!($($input,)*)), - parse_use_trees!($($output,)*), - ); + macro_rules! test_merge { + ([$($input:expr),* $(,)*], [$($output:expr),* $(,)*]) => { + assert_eq!( + merge_use_trees(parse_use_trees!($($input,)*)), + parse_use_trees!($($output,)*), + ); + } } test_merge!(["a::b::{c, d}", "a::b::{e, f}"], ["a::b::{c, d, e, f}"]); diff --git a/src/lib.rs b/src/lib.rs index 9540b9fd20e6c..a8958abab39df 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,10 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(decl_macro)] -#![allow(unused_attributes)] -#![feature(type_ascription)] -#![feature(unicode_internals)] #![feature(nll)] #[macro_use] diff --git a/src/macros.rs b/src/macros.rs index baf1ed45253cc..a7a6a7fc6b7a8 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -867,7 +867,8 @@ impl MacroArgParser { /// Returns a collection of parsed macro def's arguments. pub fn parse(mut self, tokens: ThinTokenStream) -> Option> { - let mut iter = (tokens.into(): TokenStream).trees(); + let stream: TokenStream = tokens.into(); + let mut iter = stream.trees(); while let Some(ref tok) = iter.next() { match tok { @@ -1398,21 +1399,23 @@ fn format_lazy_static(context: &RewriteContext, shape: Shape, ts: &TokenStream) result.push_str("lazy_static! {"); result.push_str(&nested_shape.indent.to_string_with_newline(context.config)); - macro parse_or($method:ident $(,)* $($arg:expr),* $(,)*) { - match parser.$method($($arg,)*) { - Ok(val) => { - if parser.sess.span_diagnostic.has_errors() { + macro_rules! parse_or { + ($method:ident $(,)* $($arg:expr),* $(,)*) => { + match parser.$method($($arg,)*) { + Ok(val) => { + if parser.sess.span_diagnostic.has_errors() { + parser.sess.span_diagnostic.reset_err_count(); + return None; + } else { + val + } + } + Err(mut err) => { + err.cancel(); parser.sess.span_diagnostic.reset_err_count(); return None; - } else { - val } } - Err(mut err) => { - err.cancel(); - parser.sess.span_diagnostic.reset_err_count(); - return None; - } } } diff --git a/src/overflow.rs b/src/overflow.rs index 053ce1b921285..5336b86eb4bc7 100644 --- a/src/overflow.rs +++ b/src/overflow.rs @@ -200,7 +200,7 @@ impl<'a, T: 'a + IntoOverflowableItem<'a>> IntoOverflowableItem<'a> for ptr::P { $( impl<'a> IntoOverflowableItem<'a> for ast::$ast_node { @@ -212,7 +212,7 @@ macro impl_into_overflowable_item_for_ast_node { } } -macro impl_into_overflowable_item_for_rustfmt_types { +macro_rules! impl_into_overflowable_item_for_rustfmt_types { ([$($ty:ident),*], [$($ty_with_lifetime:ident),*]) => { $( impl<'a> IntoOverflowableItem<'a> for $ty {