Skip to content

Commit 8a17c01

Browse files
committed
Update app.rs
1 parent c2fb9d0 commit 8a17c01

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

crates/rustapi-core/src/app.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ impl RustApi {
261261
format!("/{}", route.path)
262262
};
263263

264-
let entry = by_path.entry(path).or_insert_with(MethodRouter::new);
264+
let entry = by_path.entry(path).or_default();
265265
entry.insert_boxed_with_operation(method_enum, route.handler, route.operation);
266266
}
267267

@@ -763,6 +763,12 @@ pub struct RustApiConfig {
763763
layers: LayerStack,
764764
}
765765

766+
impl Default for RustApiConfig {
767+
fn default() -> Self {
768+
Self::new()
769+
}
770+
}
771+
766772
impl RustApiConfig {
767773
pub fn new() -> Self {
768774
Self {
@@ -840,7 +846,7 @@ impl RustApiConfig {
840846

841847
// Apply layers
842848
// Note: layers are applied in reverse order in RustApi::layer logic (pushing to vec)
843-
app.layers.extend(self.layers.into_iter());
849+
app.layers.extend(self.layers);
844850

845851
app
846852
}

0 commit comments

Comments
 (0)