From f21ad92438be2af36aa26a0745792b5d7101bec8 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Sun, 3 Mar 2024 15:06:35 +0100 Subject: pkgs/{profpatsch/nman,sternenseemann/rust/temp}: fix rust warnings --- pkgs/profpatsch/nman/nman.rs | 19 +++++++++---------- pkgs/sternenseemann/rust/temp.rs | 4 ++-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/pkgs/profpatsch/nman/nman.rs b/pkgs/profpatsch/nman/nman.rs index 23c43780..90746cfc 100644 --- a/pkgs/profpatsch/nman/nman.rs +++ b/pkgs/profpatsch/nman/nman.rs @@ -1,10 +1,10 @@ extern crate temp; use std::ffi::{OsStr, OsString}; -use std::fs::{read_dir, DirEntry}; +use std::fs::read_dir; use std::os::unix::ffi::OsStrExt; use std::os::unix::process::ExitStatusExt; -use std::path::{PathBuf, Path}; +use std::path::PathBuf; use std::process::{Stdio, ExitStatus, Command}; use temp::TempDir; @@ -89,9 +89,9 @@ enum DrvOutput<'a> { Man, DevMan, Out, - Doc, + // Doc, DevDoc, - Info, + // Info, Dev, Bin, Lib, @@ -200,7 +200,7 @@ fn match_man_page_file(name: &str, section: &str, page: &str) -> bool { /// matches exist, the one with an alphanumerically lower section is preferred, /// e. g. section 1 is preferred over section 3. fn build_man_page<'a>(drv: DrvWithOutput, section: Option<&str>, page: &str, tempdir: &TempDir) -> Result, NmanError<'a>> { - let mut build = Command::new("nix-store") + let build = Command::new("nix-store") .arg("--realise") .arg(drv.render()) .arg("--add-root") @@ -374,16 +374,15 @@ enum CliAction<'a> { Man(&'a str, Option<&'a str>, &'a str), } -fn main() -> std::io::Result<()> { - fn dispatch_action(progname: &str, action: CliAction) -> std::io::Result<()> { +fn main() { + fn dispatch_action(progname: &str, action: CliAction) { match action { CliAction::Usage => { println!("Usage: {} ATTR [PAGE | SECTION [PAGE]]", progname); - Ok(()) }, CliAction::Man(attr, section, page) => match open_man_page(attr, section, page) { - Ok(_) => Ok(()), + Ok(_) => (), Err(t) => { let msg = t.msg(); eprint!("error: {}", msg); @@ -456,7 +455,7 @@ mod tests { // lower =^= preferred assert!(DrvOutput::Man < DrvOutput::Out); assert!(DrvOutput::DevMan < DrvOutput::Out); - assert!(DrvOutput::Out < DrvOutput::Doc); + // assert!(DrvOutput::Out < DrvOutput::Doc); assert!(DrvOutput::Out < DrvOutput::DevDoc); assert!(DrvOutput::Out < DrvOutput::Lib); assert!(DrvOutput::Out < DrvOutput::Bin); diff --git a/pkgs/sternenseemann/rust/temp.rs b/pkgs/sternenseemann/rust/temp.rs index 94424b56..de8627ca 100644 --- a/pkgs/sternenseemann/rust/temp.rs +++ b/pkgs/sternenseemann/rust/temp.rs @@ -28,7 +28,7 @@ use std::ffi::OsStr; use std::io::{Error, ErrorKind}; use std::os::unix::ffi::{OsStrExt, OsStringExt}; -use std::path::{Path, PathBuf}; +use std::path::Path; // libc interaction @@ -73,7 +73,7 @@ impl AsRef for Temp { impl Drop for Temp { fn drop(&mut self) { - match self.kind { + let _ = match self.kind { TempKind::File => std::fs::remove_file(self.as_ref()), TempKind::Dir => std::fs::remove_dir_all(self.as_ref()), }; -- cgit 1.4.1