From b16058b4d3a03f449f06bfeff2c9110615b15597 Mon Sep 17 00:00:00 2001 From: grimhilt Date: Sat, 17 Jun 2023 01:26:13 +0200 Subject: [PATCH] cleaning imports and warnings --- src/commands/add.rs | 2 +- src/commands/clone.rs | 7 +------ src/main.rs | 2 +- src/services/download_files.rs | 4 ++-- src/services/req_props.rs | 8 ++++---- src/store/object.rs | 4 ++-- src/utils/nextsyncignore.rs | 10 ++++------ 7 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/commands/add.rs b/src/commands/add.rs index 7d9f00f..0c53d44 100644 --- a/src/commands/add.rs +++ b/src/commands/add.rs @@ -1,6 +1,6 @@ use clap::Values; use crate::utils::{self}; -use crate::utils::nextsyncignore::{self, ignore_file, ignore_files}; +use crate::utils::nextsyncignore::{self, ignore_file}; use crate::store; use std::path::{Path, PathBuf}; use std::io::Write; diff --git a/src/commands/clone.rs b/src/commands/clone.rs index 3da901c..07354ff 100644 --- a/src/commands/clone.rs +++ b/src/commands/clone.rs @@ -1,13 +1,9 @@ -use std::fs::OpenOptions; use std::fs::DirBuilder; -use std::io::prelude::*; -use std::io::{self, Cursor}; use std::path::{Path, PathBuf}; use clap::Values; use regex::Regex; -use xml::reader::{EventReader, XmlEvent}; use crate::services::api::ApiError; -use crate::services::list_folders::{ListFolders, FolderContent}; +use crate::services::list_folders::ListFolders; use crate::services::download_files::DownloadFiles; use crate::store::object; use crate::commands; @@ -24,7 +20,6 @@ pub fn clone(remote: Values<'_>) { None => { eprintln!("No username found"); todo!(); - "" } }; diff --git a/src/main.rs b/src/main.rs index 8f971b5..89bf0fe 100644 --- a/src/main.rs +++ b/src/main.rs @@ -106,7 +106,7 @@ fn main() { if let Some(remote) = matches.values_of("remote") { commands::clone::clone(remote); } - } else if let Some(matches) = matches.subcommand_matches("push") { + } else if let Some(_matches) = matches.subcommand_matches("push") { commands::push::push(); } else if let Some(matches) = matches.subcommand_matches("config") { if let Some(mut var) = matches.values_of("variable") { diff --git a/src/services/download_files.rs b/src/services/download_files.rs index c446eda..0aac3cc 100644 --- a/src/services/download_files.rs +++ b/src/services/download_files.rs @@ -1,6 +1,6 @@ use crate::services::api::{ApiBuilder, ApiError}; use std::path::PathBuf; -use reqwest::{Method, IntoUrl, Response, Error}; +use reqwest::{Method, Response, Error}; use crate::utils::api::get_local_path_t; use std::fs::OpenOptions; use std::io::{self, Write}; @@ -28,7 +28,7 @@ impl DownloadFiles { self.api_builder.send().await } - pub async fn send_with_err(mut self) -> Result, ApiError> { + pub async fn _send_with_err(mut self) -> Result, ApiError> { let res = self.send().await.map_err(ApiError::RequestError)?; if res.status().is_success() { let body = res.bytes().await.map_err(ApiError::EmptyError)?; diff --git a/src/services/req_props.rs b/src/services/req_props.rs index 31447fe..d921134 100644 --- a/src/services/req_props.rs +++ b/src/services/req_props.rs @@ -35,25 +35,25 @@ impl ReqProps { self } - pub fn getcontenttype(&mut self) -> &mut ReqProps { + pub fn _getcontenttype(&mut self) -> &mut ReqProps { self.xml_list.push(String::from("getcontenttype")); self.xml_payload.push_str(r#""#); self } - pub fn getpermissions(&mut self) -> &mut ReqProps { + pub fn _getpermissions(&mut self) -> &mut ReqProps { self.xml_list.push(String::from("permissions")); self.xml_payload.push_str(r#""#); self } - pub fn getressourcetype(&mut self) -> &mut ReqProps { + pub fn _getressourcetype(&mut self) -> &mut ReqProps { self.xml_list.push(String::from("resourcetype")); self.xml_payload.push_str(r#""#); self } - pub fn getetag(&mut self) -> &mut ReqProps { + pub fn _getetag(&mut self) -> &mut ReqProps { self.xml_list.push(String::from("getetag")); self.xml_payload.push_str(r#""#); self diff --git a/src/store/object.rs b/src/store/object.rs index 9249314..418e483 100644 --- a/src/store/object.rs +++ b/src/store/object.rs @@ -57,7 +57,7 @@ pub fn add_tree(path: &Path) -> io::Result<()> { } pub fn rm_blob(path: &Path) -> io::Result<()> { - let (line, hash, name) = parse_path(path.clone(), true); + let (line, hash, _) = parse_path(path.clone(), true); // remove blob reference to parent if path.iter().count() == 1 { @@ -111,7 +111,7 @@ fn hash_obj(obj: &str) -> (String, String) { (String::from(dir), String::from(res)) } -fn object_path(obj: &str) -> PathBuf { +fn _object_path(obj: &str) -> PathBuf { let mut root = match path::objects() { Some(path) => path, None => todo!(), diff --git a/src/utils/nextsyncignore.rs b/src/utils/nextsyncignore.rs index 8b1d62d..aec8088 100644 --- a/src/utils/nextsyncignore.rs +++ b/src/utils/nextsyncignore.rs @@ -1,7 +1,7 @@ use crate::utils::path; use regex::Regex; use std::fs::File; -use std::io::{Cursor, BufReader, BufRead}; +use std::io::{BufReader, BufRead}; pub fn read_lines() -> Result, ()> { if let Some(path) = path::nextsyncignore() { @@ -23,12 +23,10 @@ pub fn read_lines() -> Result, ()> { Ok(vec![]) } -pub fn ignore_files(files: &mut Vec) -> (bool, Vec) { +pub fn _ignore_files(files: &mut Vec) -> (bool, Vec) { let mut ignored_f = vec![]; - if let Some(path) = path::nextsyncignore() { - if let Ok(lines) = read_lines() { - files.retain(|file| !ignore_file(file, lines.clone(), &mut ignored_f)); - } + if let Ok(lines) = read_lines() { + files.retain(|file| !ignore_file(file, lines.clone(), &mut ignored_f)); } (ignored_f.len() > 0, ignored_f) }