diff --git a/actix-router/src/resource.rs b/actix-router/src/resource.rs index a3e89a1fe..80c0a2d68 100644 --- a/actix-router/src/resource.rs +++ b/actix-router/src/resource.rs @@ -501,7 +501,12 @@ impl ResourceDef { let patterns = self .pattern_iter() .flat_map(move |this| other.pattern_iter().map(move |other| (this, other))) - .map(|(this, other)| [this, other].join("")) + .map(|(this, other)| { + let mut pattern = String::with_capacity(this.len() + other.len()); + pattern.push_str(this); + pattern.push_str(other); + pattern + }) .collect::>(); match patterns.len() {