codegen: Avoid allocation in workspace_root()

This commit is contained in:
Taiki Endo
2026-03-09 00:29:35 +09:00
parent 93ea0b33c3
commit 5ccf6295e6
3 changed files with 7 additions and 10 deletions

View File

@@ -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())
}