Skip to content

Commit

Permalink
Don't create a RouteId if routes can be merged (#2174)
Browse files Browse the repository at this point in the history
  • Loading branch information
danpls authored Aug 14, 2023
1 parent f798839 commit 483ba7d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions axum/src/routing/path_router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ where

validate_path(path)?;

let id = self.next_route_id();

let endpoint = if let Some((route_id, Endpoint::MethodRouter(prev_method_router))) = self
.node
.path_to_route_id
Expand All @@ -74,6 +72,7 @@ where
Endpoint::MethodRouter(method_router)
};

let id = self.next_route_id();
self.set_node(path, id)?;
self.routes.insert(id, endpoint);

Expand Down

0 comments on commit 483ba7d

Please sign in to comment.