Skip to content

Commit 03df20a

Browse files
committed
use mimalloc for emmylua_check and emmylua_doc_cli
1 parent c859957 commit 03df20a

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

Cargo.lock

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

crates/emmylua_check/src/bin/emmylua_check.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
use clap::Parser;
22
use emmylua_check::{cmd_args::CmdArgs, run_check};
3+
use mimalloc::MiMalloc;
34
use std::error::Error;
45

6+
#[global_allocator]
7+
static GLOBAL: MiMalloc = MiMalloc;
8+
59
#[tokio::main]
610
async fn main() -> Result<(), Box<dyn Error + Sync + Send>> {
711
let cmd_args = CmdArgs::parse();

crates/emmylua_doc_cli/Cargo.toml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,24 @@ rowan.workspace = true
2828
walkdir.workspace = true
2929
tera.workspace = true
3030
include_dir.workspace = true
31-
clap.workspace = true
3231
num-traits.workspace = true
3332
log.workspace = true
3433
fern.workspace = true
3534

35+
[dependencies.clap]
36+
workspace = true
37+
optional = true
38+
39+
[dependencies.mimalloc]
40+
workspace = true
41+
optional = true
42+
3643
[[bin]]
3744
name = "emmylua_doc_cli"
45+
required-features = ["cli"]
46+
47+
[features]
48+
default = ["cli"]
49+
cli = ["dep:clap", "dep:mimalloc"]
50+
3851

crates/emmylua_doc_cli/src/bin/emmylua_doc_cli.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
use emmylua_doc_cli::{CmdArgs, Parser, run_doc_cli};
2+
use mimalloc::MiMalloc;
3+
4+
#[global_allocator]
5+
static GLOBAL: MiMalloc = MiMalloc;
26

37
fn main() -> Result<(), Box<dyn std::error::Error>> {
48
let cmd_args = CmdArgs::parse();

0 commit comments

Comments
 (0)