Skip to content

Commit

Permalink
replace lazy static with once cell
Browse files Browse the repository at this point in the history
  • Loading branch information
cjbassi committed Jan 23, 2020
1 parent 9301742 commit 39231ce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
8 changes: 4 additions & 4 deletions 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
Expand Up @@ -13,7 +13,6 @@ crossbeam-channel = "0.4.0"
crossterm = "0.14.1"
ctrlc = { version = "3.1.3", features = ["termination"] }
fern = "0.5.9"
lazy_static = "1.4.0"
log = "0.4.8"
num-rational = "0.2.2"
platform-dirs = "0.2.0"
Expand All @@ -27,3 +26,4 @@ structopt = "0.3.7"
tui = { git = "https://github.com/cjbassi/tui-rs", branch = "master", features = ["crossterm"] }
backtrace = "0.3.40"
battery = "0.7.5"
once_cell = "1.3.1"
11 changes: 5 additions & 6 deletions src/widgets/help_menu.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use lazy_static::lazy_static;
use once_cell::sync::Lazy;
use tui::buffer::Buffer;
use tui::layout::Rect;
use tui::widgets::{Paragraph, Text, Widget};
Expand Down Expand Up @@ -37,12 +37,11 @@ CPU and Mem graph scaling:
const TEXT_WIDTH: u16 = 48;
const TEXT_HEIGHT: u16 = 29;

lazy_static! {
static ref TEXT_VEC: Vec<Text<'static>> = TEXT
.lines()
static TEXT_VEC: Lazy<Vec<Text<'static>>> = Lazy::new(|| {
TEXT.lines()
.map(|line| Text::raw(format!("{}\n", line)))
.collect();
}
.collect()
});

pub struct HelpMenu<'a> {
title: String,
Expand Down

0 comments on commit 39231ce

Please sign in to comment.