Skip to content

Commit

Permalink
refactor(cli): remove once_cell dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
hougesen committed Feb 5, 2025
1 parent 52a07b5 commit 5c61f90
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 13 deletions.
1 change: 0 additions & 1 deletion 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 @@ -24,7 +24,6 @@ ignore = "0.4.23"
json_comments = "0.2.2"
log = "0.4.25"
mdsf = { path = "./mdsf", features = ["json-schema"] }
once_cell = "1.20.2"
process_control = { version = "5.0.0" }
regex = "1.11.1"
reqwest = { version = "0.12.12", default-features = false, features = [
Expand Down
11 changes: 4 additions & 7 deletions codegen/src/tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,7 @@ impl Tool {
if cmd.is_empty() {
String::new()
} else {
format!(
"_{}",
cmd.replace('.', "_").replace(":", "_").to_case(Case::Snake)
)
format!("_{}", cmd.replace(['.', ':'], "_").to_case(Case::Snake))
}
)
}
Expand Down Expand Up @@ -234,17 +231,17 @@ impl Tool {
{
if self.packages.npm.is_some() {
command_types.push(format!("CommandType::NodeModules(\"{}\")", self.binary));
};
}

if let Some(php) = &self.packages.composer {
command_types.push(format!("CommandType::PhpVendor(\"{}\")", php.binary));
};
}

command_types.push(format!("CommandType::Direct(\"{}\")", self.binary));

if let Some(npm) = &self.packages.npm {
command_types.push(format!("CommandType::Npm(\"{npm}\")"));
};
}
};

// TODO: generate if statements instead of array
Expand Down
1 change: 1 addition & 0 deletions mdsf-vscode/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist
node_modules
out
1 change: 0 additions & 1 deletion mdsf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ env_logger = { workspace = true }
ignore = { workspace = true }
json_comments = { workspace = true }
log = { workspace = true }
once_cell = { workspace = true }
process_control = { workspace = true }
regex = { workspace = true }
schemars = { workspace = true, optional = true }
Expand Down
2 changes: 1 addition & 1 deletion mdsf/src/commands/completions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ pub fn run(args: &CompletionsCommandArguments) {
cmd_name,
&mut std::io::stdout(),
),
};
}
}
4 changes: 2 additions & 2 deletions mdsf/src/parser/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use core::{iter::Enumerate, str::Lines};

use once_cell::sync::Lazy;
use regex::Regex;

use crate::GO_TEMPORARY_PACKAGE_NAME;
Expand Down Expand Up @@ -41,7 +40,8 @@ pub fn parse_go_codeblock(lines: &mut Enumerate<Lines>) -> (bool, String, usize)
}

// TODO: check for multiline comments
pub static GO_PACKAGE_RE: Lazy<Regex> = Lazy::new(|| Regex::new(r"^\s*package\s+\w").unwrap());
pub static GO_PACKAGE_RE: std::sync::LazyLock<Regex> =
std::sync::LazyLock::new(|| Regex::new(r"^\s*package\s+\w").unwrap());

#[cfg(test)]
mod test_go_package_re {
Expand Down

0 comments on commit 5c61f90

Please sign in to comment.