Skip to content

Commit

Permalink
Use non-captured identifier in format string
Browse files Browse the repository at this point in the history
To ensure that MSRV of 1.56.1 still holds, replace the captured
identifier in format strings. Capturing identifierts for format strings
was introduced with Rust 1.58.0.
  • Loading branch information
evnu committed Apr 24, 2023
1 parent cb8c1e7 commit 5178789
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rustler_tests/native/rustler_test/src/test_tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ pub fn greeting_person_from_tuple(age_and_name: (u8, &str)) -> String {
let (age, name) = age_and_name;

if age > 18 {
format!("Hello, {name}! You are allowed in the bar area.")
format!("Hello, {}! You are allowed in the bar area.", name)
} else {
format!("Hi, {name}! I'm sorry, but you are not allowed in the bar area.")
format!(
"Hi, {}! I'm sorry, but you are not allowed in the bar area.",
name
)
}
}

0 comments on commit 5178789

Please sign in to comment.