Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrove committed Dec 30, 2023
1 parent dc55ab7 commit e6f5f27
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions ballista/cache/src/listener/loading_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ where
fn listen_on_get_if_present(&self, k: Self::K, v: Option<Self::V>) {
if self.listeners.len() == 1 {
self.listeners
.get(0)
.first()
.unwrap()
.listen_on_get_if_present(k, v);
} else {
Expand All @@ -157,7 +157,7 @@ where

fn listen_on_get(&self, k: Self::K, v: Self::V, status: CacheGetStatus) {
if self.listeners.len() == 1 {
self.listeners.get(0).unwrap().listen_on_get(k, v, status);
self.listeners.first().unwrap().listen_on_get(k, v, status);
} else {
self.listeners.iter().for_each(|listener| {
listener.listen_on_get(k.clone(), v.clone(), status)
Expand All @@ -167,7 +167,7 @@ where

fn listen_on_put(&self, k: Self::K, v: Self::V) {
if self.listeners.len() == 1 {
self.listeners.get(0).unwrap().listen_on_put(k, v);
self.listeners.first().unwrap().listen_on_put(k, v);
} else {
self.listeners
.iter()
Expand All @@ -177,7 +177,7 @@ where

fn listen_on_invalidate(&self, k: Self::K) {
if self.listeners.len() == 1 {
self.listeners.get(0).unwrap().listen_on_invalidate(k);
self.listeners.first().unwrap().listen_on_invalidate(k);
} else {
self.listeners
.iter()
Expand All @@ -187,7 +187,7 @@ where

fn listen_on_get_cancelling(&self, k: Self::K) {
if self.listeners.len() == 1 {
self.listeners.get(0).unwrap().listen_on_get_cancelling(k);
self.listeners.first().unwrap().listen_on_get_cancelling(k);
} else {
self.listeners
.iter()
Expand Down
4 changes: 2 additions & 2 deletions ballista/scheduler/src/cluster/storage/etcd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl KeyValueStore for EtcdClient {
.await
.map_err(|e| ballista_error(&format!("etcd error {e:?}")))?
.kvs()
.get(0)
.first()
.map(|kv| kv.value().to_owned())
.unwrap_or_default())
}
Expand Down Expand Up @@ -181,7 +181,7 @@ impl KeyValueStore for EtcdClient {
.await
.map_err(|e| ballista_error(&format!("etcd error {e:?}")))?
.kvs()
.get(0)
.first()
.map(|kv| kv.value().to_owned());

if let Some(value) = current_value {
Expand Down
2 changes: 1 addition & 1 deletion ballista/scheduler/src/state/task_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ impl<T: 'static + AsLogicalPlan, U: 'static + AsExecutionPlan> TaskManager<T, U>
&self,
tasks: Vec<TaskDescription>,
) -> Result<Vec<MultiTaskDefinition>> {
if let Some(task) = tasks.get(0) {
if let Some(task) = tasks.first() {
let session_id = task.session_id.clone();
let job_id = task.partition.job_id.clone();
let stage_id = task.partition.stage_id;
Expand Down

0 comments on commit e6f5f27

Please sign in to comment.