Skip to content

Commit

Permalink
fix:cargo clippy check
Browse files Browse the repository at this point in the history
  • Loading branch information
baoyachi committed Oct 8, 2024
1 parent a5270cc commit 9aeee8c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shadow-rs"
version = "0.35.0"
version = "0.35.1"
authors = ["baoyachi <[email protected]>"]
edition = "2021"
description = "A build-time information stored in your rust project"
Expand Down
5 changes: 3 additions & 2 deletions example_shadow_hook/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ fn hook(file: &File) -> SdResult<()> {
}

fn append_write_const(mut file: &File) -> SdResult<()> {
let hook_const: &str = r#"pub const HOOK_CONST: &str = "hello hook const";"#;
let hook_const: &str = r#"#[allow(clippy::all, clippy::pedantic, clippy::restriction, clippy::nursery)]
pub const HOOK_CONST: &str = "hello hook const";"#;
writeln!(file, "{hook_const}")?;
Ok(())
}

fn append_write_fn(mut file: &File) -> SdResult<()> {
let hook_fn: &str = r#"
pub fn hook_fn() -> &'static str{
"hello hook bar fn"
HOOK_CONST
}"#;
writeln!(file, "{hook_fn}")?;
Ok(())
Expand Down
1 change: 1 addition & 0 deletions example_shadow_hook/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ fn main() {
// how to use new_hook function: https://github.com/baoyachi/shadow-rs/blob/master/example_shadow_hook/build.rs
println!("const:{}", build::HOOK_CONST); //expect:'hello hook const'
println!("fn:{}", build::hook_fn()); //expect:'hello hook bar fn'
assert_eq!(build::hook_fn(), build::HOOK_CONST);
}

0 comments on commit 9aeee8c

Please sign in to comment.