fix: add missing imports and remove unused ones

This commit is contained in:
Andrew Phillips (aider)
2025-05-10 11:47:47 -03:00
parent f913abda58
commit 86d2c2f9f5
3 changed files with 8 additions and 6 deletions

View File

@@ -2,7 +2,6 @@ use nix::fcntl::FdFlag;
use nix::unistd::{close, pipe};
use nix::Error as NixError;
use std::collections::HashMap;
use std::io;
use std::os::fd::FromRawFd;
use std::path::PathBuf;
use std::process::Stdio; // For Stdio::null, Stdio::piped
@@ -10,7 +9,6 @@ use std::process::Stdio; // For Stdio::null, Stdio::piped
use anyhow::{anyhow, Context, Error, Result};
use clap::error::ErrorKind;
use clap::*;
use gethostname::gethostname;
use log::*;
use rusqlite::Connection;
mod modes;
@@ -27,6 +25,7 @@ use prettytable::format::{Alignment, TableFormat};
use prettytable::row;
use prettytable::{Attr, Cell, Row, Table};
use std::str::FromStr;
use chrono::prelude::*;
#[macro_use]
@@ -215,6 +214,7 @@ pub enum ColumnType {
}
fn main() -> Result<(), Error> {
use std::fs;
let proj_dirs = ProjectDirs::from("gt0.ca", "Andrew Phillips", "Keep");
let mut cmd = Args::command();
@@ -444,6 +444,7 @@ fn mode_diff(
std::thread::spawn(move || {
// Original code used .expect/.unwrap, implying panics on error.
// This matches that style. For more robust error handling, return Result from thread.
use std::io::BufWriter;
let mut buffered_pipe_writer_a = BufWriter::new(pipe_writer_a_raw);
let engine_a = compression::get_engine(compression_type_a_clone)
.expect("Unable to get compression engine for Item A");

View File

@@ -1,6 +1,7 @@
use anyhow::anyhow;
use crate::compression::CompressionType;
use std::str::FromStr;
use clap::Command;
use std::path::PathBuf;
use std::str::FromStr;

View File

@@ -6,12 +6,12 @@ use std::str::FromStr;
use clap::error::ErrorKind;
use clap::Command;
use log::{debug, warn};
use log::debug;
use rusqlite::Connection;
use crate::compression::CompressionType;
use crate::db::{self, Item, Meta};
use crate::modes::common::{get_meta_from_env, format_size, string_column};
use crate::db::{self};
use crate::modes::common::{get_meta_from_env};
use chrono::Utc;
pub fn mode_save(
@@ -40,6 +40,7 @@ pub fn mode_save(
.unwrap_or(compression::default_type().to_string());
use gethostname::gethostname;
use std::io::Write;
let compression_type_opt = CompressionType::from_str(&compression_name);
if compression_type_opt.is_err() {
cmd.error(
@@ -65,7 +66,6 @@ use gethostname::gethostname;
if !args.options.quiet {
if std::io::stderr().is_terminal() {
use is_terminal::IsTerminal;
let mut t = term::stderr().unwrap();
t.reset().unwrap_or(());
t.attr(term::Attr::Bold).unwrap_or(());