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

updated method for static initialization of Config types #10

Closed
wants to merge 4 commits into from

Conversation

artech-git
Copy link
Contributor

using once_cell instead of lazy_static block macro for initializing & setting global/local statics

  1. Updated Cargo.toml in frontend & backend

  2. Applied substitution in place of

    lazy_static! {
        // Load the config and treat it as a read-only static value.
        static ref CONFIG: config::Config = config::Config::parse();
    }

    assignment into the static using Lazy::new() which accepts a function/closure initializer, this is present under once_cell::sync::Lazy

    use once_cell::sync::Lazy;
    // Load the config and treat it as a read-only static value.
    static CONFIG: Lazy<config::Config> = Lazy::new(|| config::Config::parse());

    this modification was applied across multiple files within backend & Frontend folder

using once_cell instead of lazy_static
using once_cell instead of lazy_static
@artech-git artech-git marked this pull request as ready for review November 2, 2022 08:52
@@ -23,11 +21,12 @@ use tokio::{
signal::unix::{signal, SignalKind},
sync::{mpsc, oneshot},
};
use once_cell::sync::Lazy;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Here and other places we would prefer the crate to be alphabetically placed in the use list. And one empty line after before the next section.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I will refactor accordingly, btw can next release contain any CONTRIBUTE.md file for easy instruction about guidelines

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Here and other places we would prefer the crate to be alphabetically placed in the use list. And one empty line after before the next section.

Does this applies to the stuff that we are importing or the start of the crate itself ?

@jim-signal
Copy link
Contributor

Hi @artech-git, thanks for the conversion! Generally it looks great. Pending more review, we'll consider merging it to the next release.

Sorted imports

Revising changes in reporter macro in /backend/src/metrics/macro.rs

Cargo formatting checks applied & validated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants