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

use OnceLock from std instead of the once_cell crate #349

Merged
merged 1 commit into from
Sep 8, 2023
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
91 changes: 36 additions & 55 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ rust-version = "1.62"

[dependencies]
thiserror = "1.0"
once_cell = "1.16"
aho-corasick = "1.0"
atom_syndication = "0.12"
chrono = "0.4"
Expand Down
4 changes: 2 additions & 2 deletions src/bot/telegram_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ use frankenstein::Update;
use isahc::prelude::*;
use isahc::HttpClient;
use isahc::Request;
use once_cell::sync::OnceCell;
use std::collections::VecDeque;
use std::path::PathBuf;
use std::sync::OnceLock;
use typed_builder::TypedBuilder;

static API: OnceCell<Api> = OnceCell::new();
static API: OnceLock<Api> = OnceLock::new();

#[derive(Clone, Debug)]
pub struct Api {
Expand Down
4 changes: 2 additions & 2 deletions src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use chrono::prelude::*;
use chrono::{DateTime, Utc};
use diesel::pg::PgConnection;
use diesel::r2d2;
use once_cell::sync::OnceCell;
use std::sync::OnceLock;

#[cfg(test)]
use diesel::connection::Connection;
Expand All @@ -15,7 +15,7 @@ pub mod feed_items;
pub mod feeds;
pub mod telegram;

static POOL: OnceCell<r2d2::Pool<r2d2::ConnectionManager<PgConnection>>> = OnceCell::new();
static POOL: OnceLock<r2d2::Pool<r2d2::ConnectionManager<PgConnection>>> = OnceLock::new();

#[cfg(test)]
pub fn establish_test_connection() -> PgConnection {
Expand Down
4 changes: 2 additions & 2 deletions src/http_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use crate::config::Config;
use isahc::config::RedirectPolicy;
use isahc::prelude::*;
use isahc::HttpClient;
use once_cell::sync::OnceCell;
use std::sync::OnceLock;
use std::time::Duration;

static CLIENT: OnceCell<HttpClient> = OnceCell::new();
static CLIENT: OnceLock<HttpClient> = OnceLock::new();

pub fn client() -> &'static HttpClient {
CLIENT.get_or_init(init_client)
Expand Down
Loading