Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 1.81 lints (extra reference and never type fallback) #322

Merged
merged 5 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ fn update_hosts_file(
for peer in peers {
hosts_builder.add_hostname(
peer.contents.ip,
&format!("{}.{}.wg", peer.contents.name, interface),
format!("{}.{}.wg", peer.contents.name, interface),
);
}
match hosts_builder.write_to(&hosts_path).with_path(&hosts_path) {
Expand Down Expand Up @@ -374,7 +374,7 @@ fn install(
if install_opts.delete_invite
|| Confirm::with_theme(&*prompts::THEME)
.wait_for_newline(true)
.with_prompt(&format!(
.with_prompt(format!(
"Delete invitation file \"{}\" now? (It's no longer needed)",
invite.to_string_lossy().yellow()
))
Expand Down Expand Up @@ -473,7 +473,7 @@ fn redeem_invite(
"Registering keypair with server (at {}).",
&config.server.internal_endpoint
);
Api::new(&config.server).http_form(
Api::new(&config.server).http_form::<_, ()>(
"POST",
"/user/redeem",
RedeemContents {
Expand Down Expand Up @@ -666,7 +666,7 @@ fn uninstall(interface: &InterfaceName, opts: &Opts, yes: bool) -> Result<(), Er

if yes
|| Confirm::with_theme(&*prompts::THEME)
.with_prompt(&format!(
.with_prompt(format!(
"Permanently delete network \"{}\"?",
interface.as_str_lossy().yellow()
))
Expand Down Expand Up @@ -742,7 +742,7 @@ fn rename_cidr(
.ok_or_else(|| anyhow!("CIDR not found."))?
.id;

api.http_form("PUT", &format!("/admin/cidrs/{id}"), cidr_request)?;
api.http_form::<_, ()>("PUT", &format!("/admin/cidrs/{id}"), cidr_request)?;
log::info!("CIDR renamed.");
} else {
log::info!("Exited without renaming CIDR.");
Expand All @@ -766,7 +766,7 @@ fn delete_cidr(
let cidr_id = prompts::delete_cidr(&cidrs, &peers, &sub_opts)?;

println!("Deleting CIDR...");
api.http("DELETE", &format!("/admin/cidrs/{cidr_id}"))?;
api.http::<()>("DELETE", &format!("/admin/cidrs/{cidr_id}"))?;

println!("CIDR deleted.");

Expand Down Expand Up @@ -842,7 +842,7 @@ fn rename_peer(
.next()
.ok_or_else(|| anyhow!("Peer not found."))?;

api.http_form("PUT", &format!("/admin/peers/{id}"), peer_request)?;
api.http_form::<_, ()>("PUT", &format!("/admin/peers/{id}"), peer_request)?;
log::info!("Peer renamed.");
} else {
log::info!("exited without renaming peer.");
Expand All @@ -867,7 +867,7 @@ fn enable_or_disable_peer(
if let Some(peer) = prompts::enable_or_disable_peer(&peers[..], &sub_opts, enable)? {
let Peer { id, mut contents } = peer;
contents.is_disabled = !enable;
api.http_form("PUT", &format!("/admin/peers/{id}"), contents)?;
api.http_form::<_, ()>("PUT", &format!("/admin/peers/{id}"), contents)?;
} else {
log::info!("exiting without enabling or disabling peer.");
}
Expand Down Expand Up @@ -905,7 +905,7 @@ fn add_association(
return Ok(());
};

api.http_form(
api.http_form::<_, ()>(
"POST",
"/admin/associations",
AssociationContents {
Expand Down Expand Up @@ -934,7 +934,7 @@ fn delete_association(
if let Some(association) =
prompts::delete_association(&associations[..], &cidrs[..], &sub_opts)?
{
api.http("DELETE", &format!("/admin/associations/{}", association.id))?;
api.http::<()>("DELETE", &format!("/admin/associations/{}", association.id))?;
} else {
log::info!("exiting without adding association.");
}
Expand Down Expand Up @@ -1016,7 +1016,7 @@ fn override_endpoint(

if let Some(contents) = endpoint_contents {
log::info!("requesting endpoint update...");
Api::new(&config.server).http_form("PUT", "/user/endpoint", contents)?;
Api::new(&config.server).http_form::<_, ()>("PUT", "/user/endpoint", contents)?;
log::info!(
"endpoint override {}",
if sub_opts.unset { "unset" } else { "set" }
Expand Down
8 changes: 5 additions & 3 deletions docker-tests/Dockerfile.innernet
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
####################################################################################################
## WireGuard
####################################################################################################
FROM golang:bookworm as wireguard

# Pin go 1.22 as the latest tag of wireguard-go (0.0.20230223) doesn't build with go 1.23+ due to
# its outdated x/net dependency. We can use latest go once they release newer version.
FROM golang:1.22-bookworm as wireguard
ARG wg_go_tag=0.0.20230223
ARG wg_tools_tag=v1.0.20210914

RUN mkdir /repo \
&& curl -L https://github.com/WireGuard/wireguard-go/archive/refs/tags/0.0.20230223.tar.gz \
&& curl -L https://github.com/WireGuard/wireguard-go/archive/refs/tags/${wg_go_tag}.tar.gz \
| tar -xzC /repo --strip-components=1 \
&& cd /repo \
&& CGO_ENABLED=0 make
Expand Down
2 changes: 1 addition & 1 deletion server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ fn uninstall(
) -> Result<(), Error> {
if yes
|| Confirm::with_theme(&*prompts::THEME)
.with_prompt(&format!(
.with_prompt(format!(
"Permanently delete network \"{}\"?",
interface.as_str_lossy().yellow()
))
Expand Down
2 changes: 1 addition & 1 deletion wireguard-control/src/backends/userspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ fn start_userspace_wireguard(iface: &InterfaceName) -> io::Result<Output> {
command.args(&[iface.to_string()]).output()?
} else {
command
.env("WG_TUN_NAME_FILE", &format!("{VAR_RUN_PATH}/{iface}.name"))
.env("WG_TUN_NAME_FILE", format!("{VAR_RUN_PATH}/{iface}.name"))
.args(["utun"])
.output()?
};
Expand Down
Loading