Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove global variable #284

Merged
merged 1 commit into from
Oct 7, 2024
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ui_test"
version = "0.27.0"
version = "0.27.1"
edition = "2021"
license = "MIT OR Apache-2.0"
description = "A test framework for testing rustc diagnostics output"
Expand Down
12 changes: 6 additions & 6 deletions src/status_emitter/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ pub struct Text {
progress: OutputVerbosity,
#[cfg(feature = "indicatif")]
handle: Arc<JoinOnDrop>,
#[cfg(feature = "indicatif")]
ids: Arc<AtomicUsize>,
}

#[cfg(feature = "indicatif")]
Expand Down Expand Up @@ -316,6 +318,7 @@ impl Text {
progress,
#[cfg(feature = "indicatif")]
handle: Arc::new(handle.into()),
ids: Arc::new(AtomicUsize::new(1)),
}
}

Expand Down Expand Up @@ -357,9 +360,6 @@ struct TextTest {
style: RevisionStyle,
}

#[cfg(feature = "indicatif")]
static ID_GENERATOR: AtomicUsize = AtomicUsize::new(1);

impl TestStatus for TextTest {
fn done(&self, result: &TestResult, aborted: bool) {
#[cfg(feature = "indicatif")]
Expand Down Expand Up @@ -458,7 +458,7 @@ impl TestStatus for TextTest {
#[cfg(feature = "indicatif")]
parent: self.id,
#[cfg(feature = "indicatif")]
id: ID_GENERATOR.fetch_add(1, Ordering::Relaxed),
id: self.text.ids.fetch_add(1, Ordering::Relaxed),
revision: revision.to_owned(),
style,
};
Expand All @@ -485,7 +485,7 @@ impl TestStatus for TextTest {
#[cfg(feature = "indicatif")]
parent: self.id,
#[cfg(feature = "indicatif")]
id: ID_GENERATOR.fetch_add(1, Ordering::Relaxed),
id: self.text.ids.fetch_add(1, Ordering::Relaxed),
revision: String::new(),
style: RevisionStyle::Show,
};
Expand All @@ -510,7 +510,7 @@ impl TestStatus for TextTest {
impl StatusEmitter for Text {
fn register_test(&self, path: PathBuf) -> Box<dyn TestStatus> {
#[cfg(feature = "indicatif")]
let id = ID_GENERATOR.fetch_add(1, Ordering::Relaxed);
let id = self.ids.fetch_add(1, Ordering::Relaxed);
#[cfg(feature = "indicatif")]
self.sender
.send(Msg::Push {
Expand Down
2 changes: 1 addition & 1 deletion tests/integrations/basic-bin/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/integrations/basic-fail-mode/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/integrations/basic-fail/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/integrations/basic/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/integrations/cargo-run/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading