remove some allow annotions and fix resulting warnings

This commit is contained in:
CodeSteak 2019-05-07 17:46:17 +02:00
parent cd5e69145f
commit 66fc54cb3e
11 changed files with 20 additions and 33 deletions

View File

@ -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();

View File

@ -1,4 +1,4 @@
use serde::{Deserializer, Serialize};
use serde::Serialize;
use std::io;
mod sha256;

View File

@ -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 {

View File

@ -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<String, Texture>,
name_index: HashMap<String, Texture>,
preview_cache: HashMap<(TextureFormat, Sha256), Vec<u8>>,
_preview_cache: HashMap<(TextureFormat, Sha256), Vec<u8>>,
}
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<Texture> {
pub fn query(&mut self, _query: &self::search::Query) -> Vec<Texture> {
unimplemented!();
// calls self::search::search(... )
}

View File

@ -1,3 +1,6 @@
#![allow(unused_variables)]
#![allow(dead_code)]
use crate::model::*;
pub struct Query {

View File

@ -1 +0,0 @@
use crate::model::*;

View File

@ -3,7 +3,7 @@ use super::*;
use std::io::*;
use std::net::*;
use serde::{Deserialize, Serialize};
use serde::Serialize;
pub struct Connection<R: Read + Sized, W: Write + Sized> {
reader: R,
@ -139,9 +139,9 @@ impl<R: Read + Sized, W: Write + Sized> Connection<R, W> {
_ => (), // 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.")
})?;

View File

@ -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.");
}

View File

@ -46,8 +46,6 @@ pub enum Command {
},
}
use super::error::*;
impl From<ProtocolError> for Package {
fn from(item: ProtocolError) -> Self {
match item {

View File

@ -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<Vec<Texture>>;

View File

@ -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<Self> {
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<Vec<Texture>> {
fn query(&mut self, _query: &[String]) -> ProtocolResult<Vec<Texture>> {
unimplemented!()
}