Skip to content

Commit

Permalink
ci: Run cargo fmt on all workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Jun 13, 2019
1 parent bdacee4 commit b01f595
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
9 changes: 8 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
language: rust
rust: stable
sudo: required
dist: trusty

git:
depth: 1

matrix:
include:
- name: "rustfmt"
env: TARGET=x86_64-unknown-linux-gnu
rust: stable
before_script:
- rustup component add rustfmt
script:
- cargo fmt --all -- --check

- env: TARGET=x86_64-unknown-linux-gnu
ALT=i686-unknown-linux-gnu
if: branch != master OR type = pull_request
Expand Down
18 changes: 9 additions & 9 deletions tests/testsuite/support/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,16 @@ thread_local! {
}

pub struct TestIdGuard {
_private: ()
_private: (),
}

pub fn init_root() -> TestIdGuard {
static NEXT_ID: AtomicUsize = AtomicUsize::new(0);

let id = NEXT_ID.fetch_add(1, Ordering::Relaxed);
TEST_ID.with(|n| { *n.borrow_mut() = Some(id) } );
TEST_ID.with(|n| *n.borrow_mut() = Some(id));

let guard = TestIdGuard {
_private: ()
};
let guard = TestIdGuard { _private: () };

root().mkdir_p();

Expand All @@ -71,15 +69,17 @@ pub fn init_root() -> TestIdGuard {

impl Drop for TestIdGuard {
fn drop(&mut self) {
TEST_ID.with(|n| { *n.borrow_mut() = None } );
TEST_ID.with(|n| *n.borrow_mut() = None);
}
}

pub fn root() -> PathBuf {
let id = TEST_ID.with(|n| {
n.borrow().expect("Tests must use the `#[cargo_test]` attribute in \
order to be able to use the crate root.")
} );
n.borrow().expect(
"Tests must use the `#[cargo_test]` attribute in \
order to be able to use the crate root.",
)
});
GLOBAL_ROOT.join(&format!("t{}", id))
}

Expand Down

0 comments on commit b01f595

Please sign in to comment.