about summary refs log tree commit diff
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2024-03-03 15:06:35 +0100
committerProfpatsch <mail@profpatsch.de>2024-03-03 15:07:23 +0100
commitf21ad92438be2af36aa26a0745792b5d7101bec8 (patch)
treead0aaa7acb9872a444e66aa131c5304f0e45e9f6
parent176293efe416dbb2c98c55a942388c3d73431a57 (diff)
pkgs/{profpatsch/nman,sternenseemann/rust/temp}: fix rust warnings
-rw-r--r--pkgs/profpatsch/nman/nman.rs19
-rw-r--r--pkgs/sternenseemann/rust/temp.rs4
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<Option<PathBuf>, 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<Path> 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()),
         };