Skip to content

Commit

Permalink
Fix some MacOS related warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Eloi DEMOLIS <eloi.demolis@clever-cloud.com>
  • Loading branch information
Wonshtrum committed Jun 14, 2023
1 parent a93f66e commit 0b435b6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
4 changes: 3 additions & 1 deletion bin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ mod util;
/// Start and restart the worker UNIX processes
mod worker;

use anyhow::{bail, Context};
#[cfg(target_os = "linux")]
use anyhow::bail;
use anyhow::Context;
use cli::Args;
#[cfg(target_os = "linux")]
use libc::{cpu_set_t, pid_t};
Expand Down
25 changes: 9 additions & 16 deletions bin/src/worker.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
#[cfg(target_os = "freebsd")]
use std::ffi::c_void;
#[cfg(target_os = "macos")]
use std::ffi::CString;
#[cfg(target_os = "macos")]
use std::iter::repeat;
#[cfg(target_os = "freebsd")]
use std::iter::repeat;
#[cfg(target_os = "freebsd")]
use std::mem::size_of;
#[cfg(target_os = "macos")]
use std::ptr::null_mut;
use std::{
collections::VecDeque,
fmt,
Expand All @@ -19,12 +7,16 @@ use std::{
os::unix::process::CommandExt,
process::Command,
};
#[cfg(target_os = "freebsd")]
use std::{ffi::c_void, iter::repeat, mem::size_of};

use anyhow::{bail, Context};
#[cfg(target_os = "linux")]
use anyhow::bail;
use anyhow::Context;
use futures::SinkExt;
use libc::{self, pid_t};
#[cfg(target_os = "macos")]
use libc::{c_char, PATH_MAX};
use libc::c_char;
use libc::{self, pid_t};
#[cfg(target_os = "freebsd")]
use libc::{sysctl, CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, PATH_MAX};
use mio::net::UnixStream;
Expand Down Expand Up @@ -421,7 +413,8 @@ extern "C" {

#[cfg(target_os = "macos")]
pub unsafe fn get_executable_path() -> anyhow::Result<String> {
let path = std::env::current_exe().with_context(|| "failed to retrieve current executable path")?;
let path =
std::env::current_exe().with_context(|| "failed to retrieve current executable path")?;
Ok(path.to_string_lossy().to_string())
}

Expand Down
7 changes: 6 additions & 1 deletion lib/src/metrics/writer.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
#[cfg(target_env = "musl")]
use std::mem;
use std::{
io::{self, Error, ErrorKind, Write},
io::{self, Write},
net::SocketAddr,
};
#[cfg(target_os = "linux")]
use std::{
io::{Error, ErrorKind},
os::unix::io::AsRawFd,
};

#[cfg(target_os = "linux")]
use libc::{c_uint, c_void, iovec, msghdr};
use mio::net::UdpSocket;

Expand Down

0 comments on commit 0b435b6

Please sign in to comment.