Don't create a RouteId if routes can be merged (#2174)

This commit is contained in:
Daniel Pauls 2023-08-14 22:38:13 +02:00 committed by GitHub
parent f7988398d0
commit 483ba7d5b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,8 +53,6 @@ where
validate_path(path)?; validate_path(path)?;
let id = self.next_route_id();
let endpoint = if let Some((route_id, Endpoint::MethodRouter(prev_method_router))) = self let endpoint = if let Some((route_id, Endpoint::MethodRouter(prev_method_router))) = self
.node .node
.path_to_route_id .path_to_route_id
@ -74,6 +72,7 @@ where
Endpoint::MethodRouter(method_router) Endpoint::MethodRouter(method_router)
}; };
let id = self.next_route_id();
self.set_node(path, id)?; self.set_node(path, id)?;
self.routes.insert(id, endpoint); self.routes.insert(id, endpoint);