fix: linting issues from clippy

This commit is contained in:
itsKaynine
2023-03-19 03:04:09 +07:00
parent b69b5ef9a2
commit f703d9be78
2 changed files with 6 additions and 8 deletions

View File

@@ -94,8 +94,7 @@ impl Injector {
// Inject prelude
if self.config.prelude {
info!("Injecting prelude script (id: {})", page.id);
_ = self
.evaluate(&mut ws, &prelude_script)
self.evaluate(&mut ws, &prelude_script)
.expect("Should be able to evaluate JS");
}
@@ -103,8 +102,7 @@ impl Injector {
for user_script in user_scripts.iter() {
// Inject using evaluate
info!("Injecting script: {}", user_script.file_path);
_ = self
.evaluate(&mut ws, &user_script.content)
self.evaluate(&mut ws, &user_script.content)
.expect("Should be able to evaluate JS");
}
@@ -176,13 +174,13 @@ impl Injector {
})
.collect();
return scripts;
scripts
}
fn spawn_process(&self) -> Result<Child> {
// Prepare args
let mut args = vec![format!("--remote-debugging-port={}", &self.port)];
args.extend(self.config.arg.iter().map(|a| a.clone()));
args.extend(self.config.arg.iter().cloned());
// Spawn child process
debug!(
@@ -258,7 +256,7 @@ impl Injector {
debug!("[Runtime.evaluate] Parsed response: {:#?}", response);
// Handle exception
if let Some(_) = response.result.exception_details {
if response.result.exception_details.is_some() {
warn!(
"[Runtime.evaluate] Caught exception while evaluating script: {:#?}",
response

View File

@@ -10,7 +10,7 @@ pub struct WebSocket {
impl WebSocket {
pub fn connect(address: &str) -> Result<Self, tungstenite::Error> {
let url = url::Url::parse(&address).expect("Should be a valid address");
let url = url::Url::parse(address).expect("Should be a valid address");
let (socket, response) = tungstenite::connect(url)?;
info!("WebSocket connected (status: {})", response.status());