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

View File

@@ -10,7 +10,7 @@ pub struct WebSocket {
impl WebSocket { impl WebSocket {
pub fn connect(address: &str) -> Result<Self, tungstenite::Error> { 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)?; let (socket, response) = tungstenite::connect(url)?;
info!("WebSocket connected (status: {})", response.status()); info!("WebSocket connected (status: {})", response.status());