addressing clippy lints

This commit is contained in:
realaravinth
2021-06-11 23:39:38 +05:30
parent ffdd1865bb
commit dcfba60c86
23 changed files with 124 additions and 109 deletions

View File

@@ -21,21 +21,15 @@ pub struct FileMap {
}
impl FileMap {
#[allow(clippy::new_without_default)]
pub fn new() -> Self {
let map = include_str!("../cache_buster_data.json");
let files = Files::new(&map);
Self { files }
}
pub fn get<'a>(&'a self, path: &'a str) -> Option<&'a str> {
// let file_path = self.files.get(path);
let file_path = self.files.get_full_path(path);
if file_path.is_some() {
let file_path = &file_path.unwrap()[1..];
return Some(file_path);
} else {
return None;
}
file_path.map(|file_path| &file_path[1..])
}
}

View File

@@ -99,7 +99,7 @@ mod tests {
let resp = test::call_service(
&mut app,
test::TestRequest::get().uri(&*crate::JS).to_request(),
test::TestRequest::get().uri(*crate::JS).to_request(),
)
.await;
assert_eq!(resp.status(), StatusCode::OK);
@@ -107,7 +107,7 @@ mod tests {
let resp = test::call_service(
&mut app,
test::TestRequest::get()
.uri(&*crate::VERIFICATIN_WIDGET_JS)
.uri(*crate::VERIFICATIN_WIDGET_JS)
.to_request(),
)
.await;
@@ -116,7 +116,7 @@ mod tests {
let resp = test::call_service(
&mut app,
test::TestRequest::get()
.uri(&*crate::VERIFICATIN_WIDGET_CSS)
.uri(*crate::VERIFICATIN_WIDGET_CSS)
.to_request(),
)
.await;