neon_arch
commited on
Commit
•
4460730
1
Parent(s):
975e8a4
chore: make clippy github action happy
Browse files- src/config_parser/parser.rs +1 -1
- src/engines/duckduckgo.rs +1 -1
- src/engines/engine_models.rs +5 -11
src/config_parser/parser.rs
CHANGED
@@ -118,7 +118,7 @@ impl Config {
|
|
118 |
{
|
119 |
Ok("./websurfx/config.lua".to_string())
|
120 |
} else {
|
121 |
-
Err(
|
122 |
}
|
123 |
}
|
124 |
}
|
|
|
118 |
{
|
119 |
Ok("./websurfx/config.lua".to_string())
|
120 |
} else {
|
121 |
+
Err("Config file not found!!".to_string().into())
|
122 |
}
|
123 |
}
|
124 |
}
|
src/engines/duckduckgo.rs
CHANGED
@@ -70,7 +70,7 @@ pub async fn results(
|
|
70 |
|
71 |
let no_result: Selector = Selector::parse(".no-results")?;
|
72 |
|
73 |
-
if
|
74 |
return Err(EngineErrorKind::EmptyResultSet);
|
75 |
}
|
76 |
|
|
|
70 |
|
71 |
let no_result: Selector = Selector::parse(".no-results")?;
|
72 |
|
73 |
+
if document.select(&no_result).next().is_some() {
|
74 |
return Err(EngineErrorKind::EmptyResultSet);
|
75 |
}
|
76 |
|
src/engines/engine_models.rs
CHANGED
@@ -41,26 +41,20 @@ impl std::error::Error for EngineErrorKind {}
|
|
41 |
/// Implementing `From` trait to map the `SelectorErrorKind` to `UnexpectedError` variant.
|
42 |
impl<'a> From<SelectorErrorKind<'a>> for EngineErrorKind {
|
43 |
fn from(err: SelectorErrorKind<'a>) -> Self {
|
44 |
-
|
45 |
-
_ => Self::UnexpectedError(err.to_string()),
|
46 |
-
}
|
47 |
}
|
48 |
}
|
49 |
|
50 |
/// Implementing `From` trait to map the `InvalidHeaderValue` to `UnexpectedError` variant.
|
51 |
-
impl
|
52 |
fn from(err: InvalidHeaderValue) -> Self {
|
53 |
-
|
54 |
-
_ => Self::UnexpectedError(err.to_string()),
|
55 |
-
}
|
56 |
}
|
57 |
}
|
58 |
|
59 |
/// Implementing `From` trait to map all `reqwest::Error` to `UnexpectedError` variant.
|
60 |
-
impl
|
61 |
fn from(err: reqwest::Error) -> Self {
|
62 |
-
|
63 |
-
_ => Self::RequestError(err),
|
64 |
-
}
|
65 |
}
|
66 |
}
|
|
|
41 |
/// Implementing `From` trait to map the `SelectorErrorKind` to `UnexpectedError` variant.
|
42 |
impl<'a> From<SelectorErrorKind<'a>> for EngineErrorKind {
|
43 |
fn from(err: SelectorErrorKind<'a>) -> Self {
|
44 |
+
Self::UnexpectedError(err.to_string())
|
|
|
|
|
45 |
}
|
46 |
}
|
47 |
|
48 |
/// Implementing `From` trait to map the `InvalidHeaderValue` to `UnexpectedError` variant.
|
49 |
+
impl From<InvalidHeaderValue> for EngineErrorKind {
|
50 |
fn from(err: InvalidHeaderValue) -> Self {
|
51 |
+
Self::UnexpectedError(err.to_string())
|
|
|
|
|
52 |
}
|
53 |
}
|
54 |
|
55 |
/// Implementing `From` trait to map all `reqwest::Error` to `UnexpectedError` variant.
|
56 |
+
impl From<reqwest::Error> for EngineErrorKind {
|
57 |
fn from(err: reqwest::Error) -> Self {
|
58 |
+
Self::RequestError(err)
|
|
|
|
|
59 |
}
|
60 |
}
|