Skip to content

Commit 37f42aa

Browse files
authored
Merge pull request #284 from oli-obk/globa
Remove global variable
2 parents 3cb12b4 + 7714e22 commit 37f42aa

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ui_test"
3-
version = "0.27.0"
3+
version = "0.27.1"
44
edition = "2021"
55
license = "MIT OR Apache-2.0"
66
description = "A test framework for testing rustc diagnostics output"

src/status_emitter/text.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ pub struct Text {
4747
progress: OutputVerbosity,
4848
#[cfg(feature = "indicatif")]
4949
handle: Arc<JoinOnDrop>,
50+
#[cfg(feature = "indicatif")]
51+
ids: Arc<AtomicUsize>,
5052
}
5153

5254
#[cfg(feature = "indicatif")]
@@ -316,6 +318,7 @@ impl Text {
316318
progress,
317319
#[cfg(feature = "indicatif")]
318320
handle: Arc::new(handle.into()),
321+
ids: Arc::new(AtomicUsize::new(1)),
319322
}
320323
}
321324

@@ -357,9 +360,6 @@ struct TextTest {
357360
style: RevisionStyle,
358361
}
359362

360-
#[cfg(feature = "indicatif")]
361-
static ID_GENERATOR: AtomicUsize = AtomicUsize::new(1);
362-
363363
impl TestStatus for TextTest {
364364
fn done(&self, result: &TestResult, aborted: bool) {
365365
#[cfg(feature = "indicatif")]
@@ -458,7 +458,7 @@ impl TestStatus for TextTest {
458458
#[cfg(feature = "indicatif")]
459459
parent: self.id,
460460
#[cfg(feature = "indicatif")]
461-
id: ID_GENERATOR.fetch_add(1, Ordering::Relaxed),
461+
id: self.text.ids.fetch_add(1, Ordering::Relaxed),
462462
revision: revision.to_owned(),
463463
style,
464464
};
@@ -485,7 +485,7 @@ impl TestStatus for TextTest {
485485
#[cfg(feature = "indicatif")]
486486
parent: self.id,
487487
#[cfg(feature = "indicatif")]
488-
id: ID_GENERATOR.fetch_add(1, Ordering::Relaxed),
488+
id: self.text.ids.fetch_add(1, Ordering::Relaxed),
489489
revision: String::new(),
490490
style: RevisionStyle::Show,
491491
};
@@ -510,7 +510,7 @@ impl TestStatus for TextTest {
510510
impl StatusEmitter for Text {
511511
fn register_test(&self, path: PathBuf) -> Box<dyn TestStatus> {
512512
#[cfg(feature = "indicatif")]
513-
let id = ID_GENERATOR.fetch_add(1, Ordering::Relaxed);
513+
let id = self.ids.fetch_add(1, Ordering::Relaxed);
514514
#[cfg(feature = "indicatif")]
515515
self.sender
516516
.send(Msg::Push {

tests/integrations/basic-bin/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integrations/basic-fail-mode/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integrations/basic-fail/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integrations/basic/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integrations/cargo-run/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)