Skip to content

Commit

Permalink
Remove various feature flags
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Oct 18, 2018
1 parent 3d07646 commit 613dfcc
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/config/config_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
22 changes: 13 additions & 9 deletions src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}"]);
Expand Down
4 changes: 0 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
27 changes: 15 additions & 12 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,8 @@ impl MacroArgParser {

/// Returns a collection of parsed macro def's arguments.
pub fn parse(mut self, tokens: ThinTokenStream) -> Option<Vec<ParsedMacroArg>> {
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 {
Expand Down Expand Up @@ -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;
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ impl<'a, T: 'a + IntoOverflowableItem<'a>> IntoOverflowableItem<'a> for ptr::P<T
}
}

macro impl_into_overflowable_item_for_ast_node {
macro_rules! impl_into_overflowable_item_for_ast_node {
($($ast_node:ident),*) => {
$(
impl<'a> IntoOverflowableItem<'a> for ast::$ast_node {
Expand All @@ -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 {
Expand Down

0 comments on commit 613dfcc

Please sign in to comment.