diff --git a/server/texture-sync-server/src/main.rs b/server/texture-sync-server/src/main.rs index 098566f..b3beb42 100644 --- a/server/texture-sync-server/src/main.rs +++ b/server/texture-sync-server/src/main.rs @@ -1,8 +1,3 @@ -// TODO: remove on implementation -#![allow(unused_imports)] -#![allow(unused_variables)] -#![allow(dead_code)] - #[macro_use] extern crate serde; @@ -18,7 +13,7 @@ pub mod persistency; pub mod protocol; mod server_state; -use server_state::*; +//use server_state::*; fn main() { lovecraft::invoke(); diff --git a/server/texture-sync-server/src/model/mod.rs b/server/texture-sync-server/src/model/mod.rs index 06e4a68..c7b4af4 100644 --- a/server/texture-sync-server/src/model/mod.rs +++ b/server/texture-sync-server/src/model/mod.rs @@ -1,4 +1,4 @@ -use serde::{Deserializer, Serialize}; +use serde::Serialize; use std::io; mod sha256; diff --git a/server/texture-sync-server/src/model/texture_format.rs b/server/texture-sync-server/src/model/texture_format.rs index aa24a7e..5729af7 100644 --- a/server/texture-sync-server/src/model/texture_format.rs +++ b/server/texture-sync-server/src/model/texture_format.rs @@ -1,4 +1,7 @@ -use serde::{Deserialize, Deserializer, Serialize, Serializer}; +#![allow(unused_variables)] +#![allow(dead_code)] + +use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Deserialize, Serialize, Eq, Hash, PartialEq)] pub enum TextureFormat { diff --git a/server/texture-sync-server/src/persistency/mod.rs b/server/texture-sync-server/src/persistency/mod.rs index 1026531..17088c1 100644 --- a/server/texture-sync-server/src/persistency/mod.rs +++ b/server/texture-sync-server/src/persistency/mod.rs @@ -1,10 +1,8 @@ use crate::model::*; use std::collections::*; -use std::fs; use std::io; use std::path::{Path, PathBuf}; -use std::sync::Arc; pub use self::search::Query; mod image_convert; @@ -39,7 +37,7 @@ pub struct DataStore { id_index: HashMap, name_index: HashMap, - preview_cache: HashMap<(TextureFormat, Sha256), Vec>, + _preview_cache: HashMap<(TextureFormat, Sha256), Vec>, } impl DataStore { @@ -69,7 +67,7 @@ impl DataStore { id_index: Default::default(), name_index: Default::default(), - preview_cache: Default::default(), + _preview_cache: Default::default(), }; let metadata_file = metadata_file::MetadataFile::load(base_dir)?; @@ -173,8 +171,8 @@ impl DataStore { pub fn get_texture_preview( &mut self, - hash: &Sha256, - desired_format: TextureFormat, + _hash: &Sha256, + _desired_format: TextureFormat, ) -> TextureFileResult { unimplemented!(); } @@ -183,7 +181,7 @@ impl DataStore { unimplemented!() } - pub fn query(&mut self, query: &self::search::Query) -> Vec { + pub fn query(&mut self, _query: &self::search::Query) -> Vec { unimplemented!(); // calls self::search::search(... ) } diff --git a/server/texture-sync-server/src/persistency/search/mod.rs b/server/texture-sync-server/src/persistency/search/mod.rs index 16dada5..fcf0df7 100644 --- a/server/texture-sync-server/src/persistency/search/mod.rs +++ b/server/texture-sync-server/src/persistency/search/mod.rs @@ -1,3 +1,6 @@ +#![allow(unused_variables)] +#![allow(dead_code)] + use crate::model::*; pub struct Query { diff --git a/server/texture-sync-server/src/protocol/error.rs b/server/texture-sync-server/src/protocol/error.rs deleted file mode 100644 index caa75da..0000000 --- a/server/texture-sync-server/src/protocol/error.rs +++ /dev/null @@ -1 +0,0 @@ -use crate::model::*; diff --git a/server/texture-sync-server/src/protocol/implementation/connection.rs b/server/texture-sync-server/src/protocol/implementation/connection.rs index adf3155..7202971 100644 --- a/server/texture-sync-server/src/protocol/implementation/connection.rs +++ b/server/texture-sync-server/src/protocol/implementation/connection.rs @@ -3,7 +3,7 @@ use super::*; use std::io::*; use std::net::*; -use serde::{Deserialize, Serialize}; +use serde::Serialize; pub struct Connection { reader: R, @@ -139,9 +139,9 @@ impl Connection { _ => (), // else try other } - let json: Command = serde_json::from_slice(&payload[..]).map_err(|e| { + let json: Command = serde_json::from_slice(&payload[..]).map_err(|_e| { #[cfg(test)] - dbg!(&e); + dbg!(&_e); Error::new(ErrorKind::InvalidData, "Invalid JSON.") })?; diff --git a/server/texture-sync-server/src/protocol/implementation/listen_forever.rs b/server/texture-sync-server/src/protocol/implementation/listen_forever.rs index 7177cb1..83a8e3b 100644 --- a/server/texture-sync-server/src/protocol/implementation/listen_forever.rs +++ b/server/texture-sync-server/src/protocol/implementation/listen_forever.rs @@ -1,4 +1,3 @@ -use std::io::*; use std::net::*; use std::thread; @@ -105,7 +104,7 @@ where Ok(ReplaceTextureStatus::Ok) => { connection.send(&Package::Json(JsonValue::True))?; } - Ok(ReplaceTextureStatus::NeedTextureData(hash)) => { + Ok(ReplaceTextureStatus::NeedTextureData(_hash)) => { panic!("Contract Violation: handler must not return NeedTextureData \ when data is given."); } diff --git a/server/texture-sync-server/src/protocol/implementation/package.rs b/server/texture-sync-server/src/protocol/implementation/package.rs index ecc1154..e0c4061 100644 --- a/server/texture-sync-server/src/protocol/implementation/package.rs +++ b/server/texture-sync-server/src/protocol/implementation/package.rs @@ -46,8 +46,6 @@ pub enum Command { }, } -use super::error::*; - impl From for Package { fn from(item: ProtocolError) -> Self { match item { diff --git a/server/texture-sync-server/src/protocol/mod.rs b/server/texture-sync-server/src/protocol/mod.rs index 966cb33..7703470 100644 --- a/server/texture-sync-server/src/protocol/mod.rs +++ b/server/texture-sync-server/src/protocol/mod.rs @@ -1,13 +1,9 @@ -mod error; -pub use self::error::*; - mod implementation; pub use self::implementation::*; use crate::model::*; use std::io; -use std::sync::Arc; pub trait ProtocolHandler: Send + Sync + Clone { fn query(&mut self, query: &[String]) -> ProtocolResult>; diff --git a/server/texture-sync-server/src/server_state.rs b/server/texture-sync-server/src/server_state.rs index f899934..fa0c7a9 100644 --- a/server/texture-sync-server/src/server_state.rs +++ b/server/texture-sync-server/src/server_state.rs @@ -1,8 +1,3 @@ -// TODO: remove on implementation -#![allow(unused_imports)] -#![allow(unused_variables)] -#![allow(dead_code)] - use crate::model::*; use crate::persistency::*; use crate::protocol::*; @@ -16,6 +11,7 @@ pub struct ServerState { } impl ServerState { + #[allow(dead_code)] pub fn new(storage_path: &Path) -> std::io::Result { Ok(Self { data_store: Arc::new(RwLock::new(DataStore::new(&storage_path)?)), @@ -24,7 +20,7 @@ impl ServerState { } impl ProtocolHandler for ServerState { - fn query(&mut self, query: &[String]) -> ProtocolResult> { + fn query(&mut self, _query: &[String]) -> ProtocolResult> { unimplemented!() }