diff --git a/core/src/services/zookeeper/backend.rs b/core/src/services/zookeeper/backend.rs index 5304fbbf1c42..6d956e023b8f 100644 --- a/core/src/services/zookeeper/backend.rs +++ b/core/src/services/zookeeper/backend.rs @@ -177,7 +177,7 @@ impl ZkAdapter { path = build_rooted_abs_path("/", path.strip_suffix('/').unwrap_or(&path)); } let mut rend = path.len(); - let res = loop { + loop { let mut subpath = path.substring(0, rend); if subpath.is_empty() { subpath = "/"; @@ -204,10 +204,7 @@ impl ZkAdapter { } }, } - }; - if res.is_err() { - return res; - } + }?; match path.substring(rend + 1, path.len()).find('/') { Some(len) => { rend = len + rend + 1;