From 9a6842057a7cff220250128750a9884848ac8d5d Mon Sep 17 00:00:00 2001 From: llama Date: Thu, 20 Nov 2025 20:27:48 +0800 Subject: [PATCH] use option_env! instead of rerun-if-env-changed > As of 1.46, using env! and option_env! in source code will automatically detect changes and trigger rebuilds. https://doc.rust-lang.org/cargo/reference/build-scripts.html#rerun-if-env-changed --- rslib/i18n/build.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/rslib/i18n/build.rs b/rslib/i18n/build.rs index f604c9167..75bc38787 100644 --- a/rslib/i18n/build.rs +++ b/rslib/i18n/build.rs @@ -8,7 +8,6 @@ mod python; mod typescript; mod write_strings; -use std::env; use std::path::PathBuf; use anki_io::create_dir_all; @@ -32,8 +31,7 @@ fn main() -> Result<()> { python::write_py_interface(&modules)?; // write strings.json file to requested path - println!("cargo:rerun-if-env-changed=STRINGS_JSON"); - if let Ok(path) = env::var("STRINGS_JSON") { + if let Some(path) = option_env!("STRINGS_JSON") { if !path.is_empty() { let path = PathBuf::from(path); let meta_json = serde_json::to_string_pretty(&modules).unwrap();