mirror of
https://github.com/taiki-e/install-action.git
synced 2026-04-18 20:02:36 +08:00
codegen: Avoid allocation in workspace_root()
This commit is contained in:
@@ -2,14 +2,11 @@
|
||||
|
||||
#![allow(clippy::missing_panics_doc, clippy::too_long_first_doc_paragraph)]
|
||||
|
||||
use std::{env, path::PathBuf};
|
||||
use std::{env, path::Path};
|
||||
|
||||
pub use install_action_manifest_schema::*;
|
||||
|
||||
#[must_use]
|
||||
pub fn workspace_root() -> PathBuf {
|
||||
let mut dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
||||
dir.pop(); // codegen
|
||||
dir.pop(); // tools
|
||||
dir
|
||||
pub fn workspace_root() -> &'static Path {
|
||||
Path::new(env!("CARGO_MANIFEST_DIR").strip_suffix("tools/codegen").unwrap())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user