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 <james.o.hunt@intel.com>
This commit is contained in:
James O. D. Hunt 2021-11-23 10:26:47 +00:00
parent 9fed7d0bde
commit fcf45b0c92

View File

@ -129,7 +129,7 @@ pub type Result<T> = std::result::Result<T, &'static str>;
// 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<String> {
if str == "" {
if str.is_empty() {
return Err("string cannot be blank");
}