perf: remove unused part of URL
This commit is contained in:
parent
f49dcbc2af
commit
dfb4ae66e6
1 changed files with 2 additions and 5 deletions
|
@ -5,15 +5,13 @@ use std::{
|
|||
};
|
||||
|
||||
pub struct URL {
|
||||
raw: String,
|
||||
pub path: String,
|
||||
pub query: HashMap<String, String>,
|
||||
}
|
||||
|
||||
impl URL {
|
||||
pub fn new(url: String) -> Option<Self> {
|
||||
let raw = url;
|
||||
let mut split = raw.split('?');
|
||||
let mut split = url.split('?');
|
||||
|
||||
// Query string parsing
|
||||
let mut query = HashMap::new();
|
||||
|
@ -50,7 +48,7 @@ impl URL {
|
|||
path
|
||||
};
|
||||
|
||||
Some(URL { path, query, raw })
|
||||
Some(URL { path, query })
|
||||
}
|
||||
|
||||
/// Utility function to get a path segment by index
|
||||
|
@ -127,7 +125,6 @@ mod tests {
|
|||
fn test_url_new() {
|
||||
let url = URL::new("/".to_string()).unwrap();
|
||||
assert_eq!(url.path, "/");
|
||||
assert_eq!(url.raw, "/");
|
||||
|
||||
let url = URL::new("/path/to/resource".to_string()).unwrap();
|
||||
assert_eq!(url.path, "/path/to/resource");
|
||||
|
|
Loading…
Reference in a new issue