Skip to content

Commit 26265e3

Browse files
committed
coderabbit suggestion
1 parent 384ecba commit 26265e3

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

src/alerts/mod.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,22 +1482,11 @@ impl AlertManagerTrait for Alerts {
14821482
Ok(alerts)
14831483
}
14841484

1485-
/// Returns a sigle alert that the user has access to (based on query auth)
1485+
/// Returns a single alert that the user has access to (based on query auth)
14861486
async fn get_alert_by_id(&self, id: Ulid) -> Result<Box<dyn AlertTrait>, AlertError> {
14871487
let read_access = self.alerts.read().await;
14881488
if let Some(alert) = read_access.get(&id) {
1489-
let alert: Box<dyn AlertTrait> = match &alert.get_alert_type() {
1490-
AlertType::Threshold => {
1491-
Box::new(ThresholdAlert::from(alert.to_alert_config())) as Box<dyn AlertTrait>
1492-
}
1493-
AlertType::Anomaly => {
1494-
return Err(AlertError::NotPresentInOSS("anomaly".into()));
1495-
}
1496-
AlertType::Forecast => {
1497-
return Err(AlertError::NotPresentInOSS("forecast".into()));
1498-
}
1499-
};
1500-
Ok(alert)
1489+
Ok(alert.clone_box())
15011490
} else {
15021491
Err(AlertError::CustomError(format!(
15031492
"No alert found for the given ID- {id}"

0 commit comments

Comments
 (0)