mirror of
https://github.com/itsKaynine/electron-injector.git
synced 2026-04-03 09:46:32 +02:00
fix: linting issues from clippy
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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());
|
||||||
|
|||||||
Reference in New Issue
Block a user