Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Fanda Vacek committed Aug 5, 2024
1 parent 16c60a4 commit e0f5e62
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ rusqlite = { version = "0.31.0", features = ["bundled"] }
# For local development
#[patch."https://github.com/silicon-heaven/libshvproto-rs"]
#shvproto = { path = "../libshvproto-rs" }
[patch."https://github.com/silicon-heaven/libshvrpc-rs"]
shvrpc = { path = "../libshvrpc-rs" }
#[patch."https://github.com/silicon-heaven/libshvrpc-rs"]
#shvrpc = { path = "../libshvrpc-rs" }

[[bin]]
name = "shvbroker"
Expand Down
2 changes: 1 addition & 1 deletion src/brokerimpl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ impl BrokerImpl {
Ok(())
}
const TIMEOUT: u64 = 10;
match future::timeout(Duration::from_secs(TIMEOUT), call_subscribe1(peer_id, &subscribe_path, subscription.clone(), &broker_command_sender)).await {
match future::timeout(Duration::from_secs(TIMEOUT), call_subscribe1(peer_id, subscribe_path, subscription.clone(), &broker_command_sender)).await {
Ok(r) => {
match r {
Ok(_) => {
Expand Down
2 changes: 1 addition & 1 deletion src/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,5 +373,5 @@ fn fix_subscribe_param(frame: RpcFrame, exported_root: &str) -> shvrpc::Result<R
let new_path = join_path(exported_root, subpar.ri.path());
subpar.ri = ShvRI::from_path_method_signal(&new_path, subpar.ri.method(), subpar.ri.signal())?;
msg.set_param(subpar.to_rpcvalue());
Ok(msg.to_frame()?)
msg.to_frame()
}
20 changes: 9 additions & 11 deletions src/shvnode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use shvproto::{RpcValue, rpcvalue};
use shvrpc::metamethod::AccessLevel;
use shvrpc::rpcframe::RpcFrame;
use shvrpc::rpcmessage::{RpcError, RpcErrorCode};
use shvrpc::util::strip_prefix_path;

pub const DOT_LOCAL_GRANT: &str = "dot-local";
pub const DOT_LOCAL_DIR: &str = ".local";
Expand Down Expand Up @@ -154,17 +155,14 @@ pub fn children_on_path<V>(mounts: &BTreeMap<String, V>, path: &str) -> Option<V
let mut unique_dirs: HashSet<String> = HashSet::new();
let mut dir_exists = false;
for (key, _) in mounts.range(path.to_string()..) {
if key.starts_with(path) {
if path.is_empty() || key.len() == path.len() || key[path.len() ..].starts_with('/') {
dir_exists = true;
if key.len() > path.len() {
let dir_rest_start = if path.is_empty() { 0 } else { path.len() + 1 };
let mut updirs = key[dir_rest_start..].split('/');
if let Some(dir) = updirs.next() {
if !unique_dirs.contains(dir) {
dirs.push(dir.to_string());
unique_dirs.insert(dir.to_string());
}
if let Some(key_rest) = strip_prefix_path(key, path) {
dir_exists = true;
if !key_rest.is_empty() {
let mut updirs = key_rest.split('/');
if let Some(dir) = updirs.next() {
if !unique_dirs.contains(dir) {
dirs.push(dir.to_string());
unique_dirs.insert(dir.to_string());
}
}
}
Expand Down

0 comments on commit e0f5e62

Please sign in to comment.