From 898bc805e2f509da0bd3d7b9365ccd7538ac4d9e Mon Sep 17 00:00:00 2001 From: Ian Ornelas Date: Sun, 20 May 2018 13:28:59 -0300 Subject: [PATCH] Add rustfmt test to CI --- .travis.yml | 3 +++ src/lib.rs | 9 +++++---- src/util.rs | 8 +++++--- tests/test_manager.rs | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index c8366e8..39c6bc0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,5 +29,8 @@ branches: only: - master +before-script: + - rustup component add rustfmt-preview script: + - cargo fmt --all -- --write-mode=check - cargo test --verbose --target=$target -- --nocapture diff --git a/src/lib.rs b/src/lib.rs index a34df37..4515bcd 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,13 +10,14 @@ use rustc_target::spec::abi::Abi; use syntax::ast::{Attribute, Ident, Item, ItemKind, MetaItem, Mod, Name, Ty, VisibilityKind}; use syntax::attr; use syntax::codemap::Span; +use syntax::edition::Edition; use syntax::ext::base::SyntaxExtension::{MultiModifier, NormalTT}; -use syntax::ext::base::{Annotatable, ExtCtxt, MacEager, MacResult, MultiItemModifier, - TTMacroExpander}; +use syntax::ext::base::{ + Annotatable, ExtCtxt, MacEager, MacResult, MultiItemModifier, TTMacroExpander, +}; use syntax::feature_gate::AttributeType; use syntax::ptr::P; use syntax::tokenstream::TokenStream; -use syntax::edition::Edition; use std::cell::RefCell; use std::rc::Rc; @@ -57,7 +58,7 @@ pub fn plugin_registrar(reg: &mut Registry) { allow_internal_unsafe: false, allow_internal_unstable: false, unstable_feature: None, - edition: Edition::Edition2015 + edition: Edition::Edition2015, }, ); diff --git a/src/util.rs b/src/util.rs index 7f6b513..ecffbfe 100644 --- a/src/util.rs +++ b/src/util.rs @@ -1,8 +1,10 @@ -use syntax::{ast::{Item, ItemKind, Mod, VisibilityKind}, - ptr::P}; +use syntax::{ + ast::{Item, ItemKind, Mod, VisibilityKind}, ptr::P, +}; pub fn mod_walk(mut m: Mod, item_map: &mut FnMut(Item) -> Item) -> Mod { - m.items = m.items + m.items = m + .items .into_iter() .map(|item| { let mut item = item.into_inner(); diff --git a/tests/test_manager.rs b/tests/test_manager.rs index 50f39ba..221c946 100644 --- a/tests/test_manager.rs +++ b/tests/test_manager.rs @@ -1,5 +1,5 @@ +use std::io::{BufRead, BufReader, Write}; use std::process::{Command, Stdio}; -use std::io::{Write, BufReader, BufRead}; use std::thread::sleep; use std::time::Duration;