Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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