Skip to content

Commit 6caa8f9

Browse files
committed
fix: resolve remaining clippy warnings
- cortex-otel: collapse nested if let statements using let..&& pattern - cortex-plugins: fix deprecated HookPriority::HIGH, add #[allow(dead_code)] for unused fields - cortex-app-server: apply formatting from cargo fmt
1 parent 8d25170 commit 6caa8f9

5 files changed

Lines changed: 15 additions & 11 deletions

File tree

src/cortex-app-server/src/api/git.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -428,11 +428,8 @@ fn parse_blame(blame: &str) -> Vec<serde_json::Value> {
428428
if let Some(stripped) = line.strip_prefix("author ") {
429429
commit["author"] = serde_json::json!(stripped.to_string());
430430
} else if let Some(stripped) = line.strip_prefix("author-mail ") {
431-
commit["email"] = serde_json::json!(
432-
stripped
433-
.trim_matches(|c| c == '<' || c == '>')
434-
.to_string()
435-
);
431+
commit["email"] =
432+
serde_json::json!(stripped.trim_matches(|c| c == '<' || c == '>').to_string());
436433
} else if let Some(stripped) = line.strip_prefix("author-time ") {
437434
if let Ok(timestamp) = stripped.parse::<i64>() {
438435
commit["date"] = serde_json::json!(

src/cortex-otel/src/otel_provider.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ impl OtelProvider {
9292

9393
impl<'a> opentelemetry::propagation::Injector for HeaderCarrier<'a> {
9494
fn set(&mut self, key: &str, value: String) {
95-
if let Ok(name) = reqwest::header::HeaderName::from_bytes(key.as_bytes()) {
96-
if let Ok(val) = reqwest::header::HeaderValue::from_str(&value) {
97-
self.0.insert(name, val);
98-
}
95+
if let Ok(name) = reqwest::header::HeaderName::from_bytes(key.as_bytes())
96+
&& let Ok(val) = reqwest::header::HeaderValue::from_str(&value)
97+
{
98+
self.0.insert(name, val);
9999
}
100100
}
101101
}

src/cortex-plugins/src/hooks/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ mod tests {
282282
priority: HookPriority::LOW,
283283
});
284284
let hook_high = Arc::new(TestBeforeHook {
285-
priority: HookPriority::HIGH,
285+
priority: HookPriority::PLUGIN_HIGH,
286286
});
287287
let hook_normal = Arc::new(TestBeforeHook {
288288
priority: HookPriority::NORMAL,
@@ -301,7 +301,7 @@ mod tests {
301301

302302
// Check ordering
303303
let hooks = registry.tool_execute_before.read().await;
304-
assert_eq!(hooks[0].priority, HookPriority::HIGH);
304+
assert_eq!(hooks[0].priority, HookPriority::PLUGIN_HIGH);
305305
assert_eq!(hooks[1].priority, HookPriority::NORMAL);
306306
assert_eq!(hooks[2].priority, HookPriority::LOW);
307307
}

src/cortex-plugins/src/hooks/registry.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,41 +57,47 @@ pub(crate) struct RegisteredPermissionHook {
5757
}
5858

5959
/// Registered hook with metadata for ui.render hook type.
60+
#[allow(dead_code)]
6061
pub(crate) struct RegisteredUiRenderHook {
6162
pub plugin_id: String,
6263
pub hook: Arc<dyn UiRenderHook>,
6364
pub priority: HookPriority,
6465
}
6566

6667
/// Registered hook for widget registration.
68+
#[allow(dead_code)]
6769
pub(crate) struct RegisteredWidgetRegisterHook {
6870
pub plugin_id: String,
6971
pub hook: Arc<dyn WidgetRegisterHook>,
7072
pub priority: HookPriority,
7173
}
7274

7375
/// Registered hook for key binding registration.
76+
#[allow(dead_code)]
7477
pub(crate) struct RegisteredKeyBindingHook {
7578
pub plugin_id: String,
7679
pub hook: Arc<dyn KeyBindingHook>,
7780
pub priority: HookPriority,
7881
}
7982

8083
/// Registered hook for theme override.
84+
#[allow(dead_code)]
8185
pub(crate) struct RegisteredThemeOverrideHook {
8286
pub plugin_id: String,
8387
pub hook: Arc<dyn ThemeOverrideHook>,
8488
pub priority: HookPriority,
8589
}
8690

8791
/// Registered hook for layout customization.
92+
#[allow(dead_code)]
8893
pub(crate) struct RegisteredLayoutCustomizeHook {
8994
pub plugin_id: String,
9095
pub hook: Arc<dyn LayoutCustomizeHook>,
9196
pub priority: HookPriority,
9297
}
9398

9499
/// Registered hook for modal injection.
100+
#[allow(dead_code)]
95101
pub(crate) struct RegisteredModalInjectHook {
96102
pub plugin_id: String,
97103
pub hook: Arc<dyn ModalInjectHook>,

src/cortex-plugins/src/runtime.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const DEFAULT_FUEL_LIMIT: u64 = 10_000_000;
2828
const MAX_MEMORY_SIZE: usize = 16 * 1024 * 1024;
2929

3030
/// Maximum number of memory pages (256 pages = 16MB, each page is 64KB).
31+
#[allow(dead_code)]
3132
const MAX_MEMORY_PAGES: u64 = 256;
3233

3334
/// Maximum number of table elements.

0 commit comments

Comments
 (0)