mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-11 06:13:43 +00:00
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:
parent
9fed7d0bde
commit
fcf45b0c92
@ -129,7 +129,7 @@ pub type Result<T> = std::result::Result<T, &'static str>;
|
|||||||
// Accepts a string and an integer and returns the
|
// Accepts a string and an integer and returns the
|
||||||
// result of sticking them together separated by a dash as a string.
|
// result of sticking them together separated by a dash as a string.
|
||||||
fn join_params_with_dash(str: &str, num: i32) -> Result<String> {
|
fn join_params_with_dash(str: &str, num: i32) -> Result<String> {
|
||||||
if str == "" {
|
if str.is_empty() {
|
||||||
return Err("string cannot be blank");
|
return Err("string cannot be blank");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user