Skip to content

Commit

Permalink
Formatting & clippy findings
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmittag committed Aug 2, 2024
1 parent 17983b4 commit dd049c3
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions databroker/src/grpc/kuksa_val_v2/val.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,14 @@ impl proto::val_server::Val for broker::DataBroker {
Ok(tonic::Response::new(proto::PublishValueResponse {
error: None,
}))
} else if let Some((_, err)) = publish_values_response.status.iter().next() {
Ok(tonic::Response::new(proto::PublishValueResponse {
error: Some(err.clone()),
}))
} else {
if let Some((_, err)) = publish_values_response.status.iter().next() {
Ok(tonic::Response::new(proto::PublishValueResponse {
error: Some(err.clone()),
}))
} else {
Err(tonic::Status::internal(
"There is no error provided for the entry",
))
}
Err(tonic::Status::internal(
"There is no error provided for the entry",
))
}
}

Expand Down Expand Up @@ -519,8 +517,6 @@ mod tests {
BatchActuateStreamRequest, ProvideActuatorResponse, PublishValuesResponse,
};
use proto::{open_provider_stream_request, OpenProviderStreamRequest, PublishValuesRequest};
use tokio::stream;
use std::time::SystemTime;

/*
Test subscribe service method
Expand Down Expand Up @@ -595,21 +591,21 @@ mod tests {
})
);
} else {
assert!(false);
panic!()
}
}
item_count += 1;
}
Err(_) => {
assert!(false);
panic!()
}
}
}

// Assert the total number of items processed
assert_eq!(item_count, 2);
} else if let Err(_) = result {
assert!(false)
} else {
panic!()
}
});

Expand All @@ -625,7 +621,7 @@ mod tests {
})),
}),
};
let _ = broker.publish_value(tonic::Request::new(request_1));
let _ = broker.publish_value(tonic::Request::new(request_1)).await;
let request_2 = proto::PublishValueRequest {
signal_id: Some(proto::SignalId {
signal: Some(proto::signal_id::Signal::Id(entry_id_2)),
Expand All @@ -637,7 +633,7 @@ mod tests {
})),
}),
};
let _ = broker.publish_value(tonic::Request::new(request_2));
let _ = broker.publish_value(tonic::Request::new(request_2)).await;
});
}

Expand Down

0 comments on commit dd049c3

Please sign in to comment.