From fcf45b0c92d152ddfb222de32eaf8f9a0fe1f321 Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Tue, 23 Nov 2021 10:26:47 +0000 Subject: [PATCH] docs: Use more idiomatic rust string check Rather than comparing a string to a literal in the rust example, use `.is_empty()` as that approach is more idiomatic and preferred. Signed-off-by: James O. D. Hunt --- docs/Unit-Test-Advice.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Unit-Test-Advice.md b/docs/Unit-Test-Advice.md index 07af3922f1..cc46486a08 100644 --- a/docs/Unit-Test-Advice.md +++ b/docs/Unit-Test-Advice.md @@ -129,7 +129,7 @@ pub type Result = std::result::Result; // Accepts a string and an integer and returns the // result of sticking them together separated by a dash as a string. fn join_params_with_dash(str: &str, num: i32) -> Result { - if str == "" { + if str.is_empty() { return Err("string cannot be blank"); }