11//! Project/repository utilities.
2+ #![ allow( clippy:: shadow_reuse, reason = "sometimes its nice" ) ]
3+ #![ allow( clippy:: unwrap_used, reason = "sometimes its good" ) ]
4+ #![ allow( clippy:: unwrap_in_result, reason = "sometimes that's what you want" ) ]
25
3- use anyhow:: Context ;
4- use clap:: Parser ;
6+ use anyhow:: Context as _ ;
7+ use clap:: Parser as _ ;
58
69/// Our xtask commands.
710#[ derive( Debug , clap:: Parser ) ]
@@ -27,8 +30,11 @@ fn cmd(args: impl IntoIterator<Item = impl AsRef<str>>) -> anyhow::Result<()> {
2730 Ok ( ( ) )
2831}
2932
33+ /// Overwrites a toml file's output-dir field, and reverts that on drop.
3034struct ShaderCrateTemplateCargoTomlWriter {
35+ /// Original string
3136 original_shader_crate_template_str : String ,
37+ /// Parsed toml table
3238 table : toml:: Table ,
3339}
3440
@@ -40,8 +46,10 @@ impl Drop for ShaderCrateTemplateCargoTomlWriter {
4046}
4147
4248impl ShaderCrateTemplateCargoTomlWriter {
49+ /// Path to the Cargo.toml
4350 const PATH : & str = "crates/shader-crate-template/Cargo.toml" ;
4451
52+ /// Create a new one
4553 fn new ( ) -> Self {
4654 let original_shader_crate_template_str = std:: fs:: read_to_string ( Self :: PATH ) . unwrap ( ) ;
4755 let table = toml:: from_str :: < toml:: Table > ( & original_shader_crate_template_str) . unwrap ( ) ;
@@ -51,6 +59,7 @@ impl ShaderCrateTemplateCargoTomlWriter {
5159 }
5260 }
5361
62+ /// Replace the output-dir
5463 fn replace_output_dir ( & mut self , path : impl AsRef < std:: path:: Path > ) -> anyhow:: Result < ( ) > {
5564 let package = self
5665 . table
0 commit comments