Skip to content

Commit

Permalink
Fix clippy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kiron1 committed Dec 31, 2023
1 parent e597c07 commit 187699a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions paclib/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl<'a> Default for Engine<'a> {
fn alert(_this: &JsValue, args: &[JsValue], _ctx: &mut Context) -> JsResult<JsValue> {
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Proxy_servers_and_tunneling/Proxy_Auto-Configuration_PAC_file#alert
// https://developer.mozilla.org/en-US/docs/Web/API/Window/alert
if let Some(message) = args.get(0) {
if let Some(message) = args.first() {
let message = message
.as_string()
.map(|s| s.to_std_string_escaped())
Expand All @@ -132,7 +132,7 @@ fn dns_resolve(_this: &JsValue, args: &[JsValue], ctx: &mut Context) -> JsResult
.downcast_mut::<DnsCache>()
.expect("downcast_mut<DnsCache>");

let value = if let Some(host) = args.get(0) {
let value = if let Some(host) = args.first() {
if let Ok(host) = host.to_string(ctx) {
let resolved = dns_cache.lookup(&host.to_std_string_escaped());
match resolved {
Expand All @@ -152,7 +152,7 @@ fn dns_resolve(_this: &JsValue, args: &[JsValue], ctx: &mut Context) -> JsResult
fn my_ip_address(_this: &JsValue, _args: &[JsValue], _ctx: &mut Context) -> JsResult<JsValue> {
let ip = default_net::get_default_interface()
.ok()
.and_then(|i| i.ipv4.get(0).map(|i| i.addr.to_string()))
.and_then(|i| i.ipv4.first().map(|i| i.addr.to_string()))
.unwrap_or_else(|| String::from("127.0.0.1"));
Ok(JsValue::from(JsString::from(ip)))
}
Expand Down
2 changes: 1 addition & 1 deletion paclib/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl Proxies {
}

pub fn first(&self) -> ProxyOrDirect {
self.0.get(0).unwrap().clone()
self.0.first().unwrap().clone()
}

pub fn iter(&self) -> std::slice::Iter<ProxyOrDirect> {
Expand Down
1 change: 1 addition & 0 deletions proxydetoxlib/tests/environment/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use tokio::{net::TcpStream, sync::oneshot, task};

use proxydetoxlib::auth::{netrc, AuthenticatorFactory};

#[allow(unused_imports)]
pub use httpd::Server;

pub(crate) struct Environment {
Expand Down

0 comments on commit 187699a

Please sign in to comment.