fix a bunch of lints
This commit is contained in:
parent
aed73e99be
commit
420fac5f18
5 changed files with 40 additions and 41 deletions
|
|
@ -26,7 +26,7 @@ use crate::{
|
||||||
|
|
||||||
use crate::{OwnedFdWithFlags, TokenFd};
|
use crate::{OwnedFdWithFlags, TokenFd};
|
||||||
|
|
||||||
pub static UID: LazyLock<Uid> = LazyLock::new(|| rustix::process::getuid());
|
pub static UID: LazyLock<Uid> = LazyLock::new(rustix::process::getuid);
|
||||||
|
|
||||||
pub static USER_SOCKET_DIR: LazyLock<&'static Path> = LazyLock::new(|| {
|
pub static USER_SOCKET_DIR: LazyLock<&'static Path> = LazyLock::new(|| {
|
||||||
let dir: Box<Path> = env::var_os("XDG_RUNTIME_DIR")
|
let dir: Box<Path> = env::var_os("XDG_RUNTIME_DIR")
|
||||||
|
|
@ -52,19 +52,23 @@ pub enum ConvenientAttrPath {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConvenientAttrPath {
|
impl ConvenientAttrPath {
|
||||||
|
/// Not currently used, but here for completeness.
|
||||||
|
#[expect(dead_code)]
|
||||||
pub fn clone_from_dotted(s: &str) -> Self {
|
pub fn clone_from_dotted(s: &str) -> Self {
|
||||||
Self::Dotted(Box::from(s))
|
Self::Dotted(Box::from(s))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Not currently used, but here for completeness.
|
||||||
|
#[expect(dead_code)]
|
||||||
pub fn clone_from_split(s: &[&str]) -> Self {
|
pub fn clone_from_split(s: &[&str]) -> Self {
|
||||||
Self::from_str_iter(s.into_iter().map(Deref::deref))
|
Self::from_str_iter(s.iter().map(Deref::deref))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_str_iter<'i, I>(iter: I) -> Self
|
pub fn from_str_iter<'i, I>(iter: I) -> Self
|
||||||
where
|
where
|
||||||
I: Iterator<Item = &'i str>,
|
I: Iterator<Item = &'i str>,
|
||||||
{
|
{
|
||||||
let boxed = iter.map(|s| Box::from(s));
|
let boxed = iter.map(Box::from);
|
||||||
Self::Split(Box::from_iter(boxed))
|
Self::Split(Box::from_iter(boxed))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -254,10 +258,10 @@ impl Daemon {
|
||||||
|
|
||||||
debug!("opened daemon to {:?} file descriptor {fd:?}", name);
|
debug!("opened daemon to {:?} file descriptor {fd:?}", name);
|
||||||
|
|
||||||
let path = match &name {
|
let path = name
|
||||||
Some(name) => Some(PathBuf::from(name).into_boxed_path()),
|
.as_ref()
|
||||||
None => None,
|
.map(PathBuf::from)
|
||||||
};
|
.map(PathBuf::into_boxed_path);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
config_path,
|
config_path,
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ impl From<OwnedFd> for OwnedFdWithFlags {
|
||||||
|
|
||||||
impl Read for &OwnedFdWithFlags {
|
impl Read for &OwnedFdWithFlags {
|
||||||
fn read(&mut self, buf: &mut [u8]) -> Result<usize, IoError> {
|
fn read(&mut self, buf: &mut [u8]) -> Result<usize, IoError> {
|
||||||
debug_assert!(buf.len() > 0);
|
debug_assert!(!buf.is_empty());
|
||||||
loop {
|
loop {
|
||||||
buf.fill(0);
|
buf.fill(0);
|
||||||
match rustix::io::read(self.as_ref_owned(), &mut *buf) {
|
match rustix::io::read(self.as_ref_owned(), &mut *buf) {
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ impl FdInfo {
|
||||||
|
|
||||||
match Self::guess_name(self.fd) {
|
match Self::guess_name(self.fd) {
|
||||||
Ok(name) => {
|
Ok(name) => {
|
||||||
let prev = self.name.set(Box::from(name));
|
let prev = self.name.set(name);
|
||||||
debug_assert_eq!(prev, Ok(()));
|
debug_assert_eq!(prev, Ok(()));
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|
@ -105,13 +105,14 @@ impl<'a> Display for FdInfoDisplay<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy)]
|
#[derive(Copy)]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub enum FdKind {
|
pub enum FdKind {
|
||||||
File,
|
File,
|
||||||
Socket,
|
Socket,
|
||||||
SockStream,
|
SockStream,
|
||||||
Poller,
|
Poller,
|
||||||
|
#[default]
|
||||||
Unknown,
|
Unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,12 +129,6 @@ impl FdKind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for FdKind {
|
|
||||||
fn default() -> FdKind {
|
|
||||||
FdKind::Unknown
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Copy)]
|
#[derive(Copy)]
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct TokenFd {
|
pub struct TokenFd {
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ use tracing_subscriber::{EnvFilter, layer::SubscriberExt};
|
||||||
|
|
||||||
fn main_wrapped() -> Result<(), Box<dyn StdError + Send + Sync + 'static>> {
|
fn main_wrapped() -> Result<(), Box<dyn StdError + Send + Sync + 'static>> {
|
||||||
// Default RUST_LOG to warn if it's not specified.
|
// Default RUST_LOG to warn if it's not specified.
|
||||||
if let None = env::var_os("RUST_LOG") {
|
if env::var_os("RUST_LOG").is_none() {
|
||||||
unsafe {
|
unsafe {
|
||||||
env::set_var("RUST_LOG", "warn");
|
env::set_var("RUST_LOG", "warn");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,27 +5,27 @@
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Hash)]
|
//#[derive(Debug, Clone, PartialEq, Hash)]
|
||||||
pub(crate) struct NixEvalExpr<E, A> {
|
//pub(crate) struct NixEvalExpr<E, A> {
|
||||||
pub(crate) expr: E,
|
// pub(crate) expr: E,
|
||||||
pub(crate) attrpath: A,
|
// pub(crate) attrpath: A,
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
impl<E, A> NixEvalExpr<E, A>
|
//impl<E, A> NixEvalExpr<E, A>
|
||||||
where
|
//where
|
||||||
E: AsRef<OsStr>,
|
// E: AsRef<OsStr>,
|
||||||
A: AsRef<OsStr>,
|
// A: AsRef<OsStr>,
|
||||||
{
|
//{
|
||||||
pub(crate) fn into_command(self) -> Command {
|
// pub(crate) fn into_command(self) -> Command {
|
||||||
let mut cmd = Command::new("nix-instantiate");
|
// let mut cmd = Command::new("nix-instantiate");
|
||||||
cmd.arg("--eval")
|
// cmd.arg("--eval")
|
||||||
.arg("--json")
|
// .arg("--json")
|
||||||
.arg("--strict")
|
// .arg("--strict")
|
||||||
.arg("--expr")
|
// .arg("--expr")
|
||||||
.arg(self.expr)
|
// .arg(self.expr)
|
||||||
.arg("-A")
|
// .arg("-A")
|
||||||
.arg(self.attrpath);
|
// .arg(self.attrpath);
|
||||||
|
//
|
||||||
cmd
|
// cmd
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue