Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler warnings cleanup #288

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tesseract-clickhouse/src/sql/rate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub fn rate_calculation(
primary_agg(table, cuts, &new_drills, meas, None)
};

let mut rate_sql = "".to_string();
let mut rate_sql;

// Wrap that around a pivot
let original_drill_cols = drills.iter().map(|drill| drill.col_alias_only_string());
Expand Down
2 changes: 1 addition & 1 deletion tesseract-core/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub trait Backend {
/// Takes in a SQL string, outputs a stream of
/// DataFrames, which will go on to be formatted into the
/// desired query output format.
fn exec_sql_stream(&self, sql: String) -> Box<dyn Stream<Item=Result<DataFrame, Error>, Error=Error>> {
fn exec_sql_stream(&self, _sql: String) -> Box<dyn Stream<Item=Result<DataFrame, Error>, Error=Error>> {
unimplemented!()
}

Expand Down
9 changes: 3 additions & 6 deletions tesseract-core/src/format_stream.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use bytes::Bytes;
use csv;
use failure::{Error, format_err};
use failure::Error;
use futures::{Stream, Async, Poll};
use indexmap::IndexMap;
use serde::Serializer;
Expand Down Expand Up @@ -117,8 +117,7 @@ impl<S> Stream for RecordBlockStream<S>

self.sent_header = true;
return Ok(Async::Ready(Some(bytes)));
},
_ => return Err(format_err!("just csv first")),
}
}
}

Expand Down Expand Up @@ -147,8 +146,7 @@ impl<S> Stream for RecordBlockStream<S>
FormatType::JsonArrays => {
let res = b"]}".to_vec().into();
return Ok(Async::Ready(Some(res)));
},
_ => return Err(format_err!("just csv first")),
}
}
},
};
Expand Down Expand Up @@ -198,7 +196,6 @@ impl<S> Stream for RecordBlockStream<S>

return Ok(Async::Ready(Some(body)));
}
_ => return Err(format_err!("just csv first")),
};

return Ok(Async::Ready(Some(formatted)));
Expand Down
4 changes: 2 additions & 2 deletions tesseract-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ impl Schema {
Ok(column)
}

fn get_mea_col(&self, cube_name: &str, measure: &Measure) -> Result<String, Error> {
/* fn get_mea_col(&self, cube_name: &str, measure: &Measure) -> Result<String, Error> {
D2SD marked this conversation as resolved.
Show resolved Hide resolved
let cube = self.cubes.iter()
.find(|cube| &cube.name == &cube_name)
.ok_or(format_err!("Could not find cube"))?;
Expand All @@ -1269,7 +1269,7 @@ impl Schema {
let column = mea.column.clone();

Ok(column)
}
} */

pub fn get_cube_by_name(&self, cube_name: &str) -> Result<&Cube, Error> {
self.cubes.iter()
Expand Down
2 changes: 1 addition & 1 deletion tesseract-mysql/src/df.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use mysql_async::Value::*;
use std::str;
use tesseract_core::{DataFrame, Column, ColumnData};

pub fn rows_to_df(query_result: QueryResult<Conn, BinaryProtocol>) -> Box<Future<Item=DataFrame, Error=Error>> {
pub fn rows_to_df(query_result: QueryResult<Conn, BinaryProtocol>) -> Box< dyn Future<Item=DataFrame, Error=Error>> {
let mut tcolumn_list = vec![];
let columns = query_result.columns_ref();

Expand Down
2 changes: 1 addition & 1 deletion tesseract-mysql/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl MySql {
}

impl Backend for MySql {
fn exec_sql(&self, sql: String) -> Box<Future<Item=DataFrame, Error=Error>> {
fn exec_sql(&self, sql: String) -> Box< dyn Future<Item=DataFrame, Error=Error>> {
let future = self.pool.get_conn()
.and_then(move |conn| {
conn.prep_exec(sql.to_string(), ())
Expand Down
2 changes: 1 addition & 1 deletion tesseract-postgres/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl Postgres {
// 2. dataframe creation

impl Backend for Postgres {
fn exec_sql(&self, sql: String) -> Box<Future<Item=DataFrame, Error=Error>> {
fn exec_sql(&self, sql: String) -> Box< dyn Future<Item=DataFrame, Error=Error>> {
let fut = self.pool.run(move |mut connection| {
connection.prepare(&sql).then( |r| match r {
Ok(select) => {
Expand Down
19 changes: 7 additions & 12 deletions tesseract-server/src/handlers/diagnosis.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::collections::HashMap;
use std::str;

use actix_web::{
Expand All @@ -7,22 +6,18 @@ use actix_web::{
Path,
Result as ActixResult,
};
use failure::{Error, format_err};
use failure::Error;
use futures::future::Future;
use lazy_static::lazy_static;
use log::*;
use serde_qs as qs;
use serde_derive::Deserialize;
use url::Url;

use tesseract_core::names::{Property, LevelName};
use tesseract_core::format::{format_records, FormatType};
use tesseract_core::{DataFrame, Column, ColumnData};
use tesseract_core::schema::{Cube, DimensionType, Level};
use tesseract_core::schema::{Cube, Level};
use crate::app::AppState;
use crate::logic_layer::{LogicLayerConfig, CubeCache};
use crate::handlers::util::{verify_authorization, format_to_content_type};
use crate::handlers::logic_layer::{query_geoservice, GeoserviceQuery};


/// Handles default aggregation when a format is not specified.
Expand All @@ -37,7 +32,7 @@ pub fn diagnosis_default_handler(

/// Handles aggregation when a format is specified.
pub fn diagnosis_handler(
(req, cube_format): (HttpRequest<AppState>, Path<(String)>)
(req, cube_format): (HttpRequest<AppState>, Path<String>)
) -> ActixResult<HttpResponse>
{
perform_diagnosis(req, cube_format.to_owned())
Expand Down Expand Up @@ -99,7 +94,7 @@ pub fn perform_diagnosis(
let mut error_messages: Vec<String> = vec![];

for cube in &schema.cubes {
if let Err(err) = verify_authorization(&req, cube.min_auth_level) {
if let Err(_err) = verify_authorization(&req, cube.min_auth_level) {
continue;
}

Expand All @@ -109,7 +104,7 @@ pub fn perform_diagnosis(
if new_error_types.len() != 0 {
let mut new_error_cubes: Vec<String> = vec![];

for i in 0..new_error_types.len() {
for _i in 0..new_error_types.len() {
new_error_cubes.push(cube.name.clone());
}

Expand Down Expand Up @@ -171,7 +166,7 @@ fn diagnose_cube(req: &HttpRequest<AppState>, cube: &Cube) -> (Vec<String>, Vec<
None => ()
}
},
Err(err) => ()
Err(_err) => ()
}

// Check for `NonUniqueDimensionIDs`
Expand Down Expand Up @@ -204,7 +199,7 @@ fn diagnose_cube(req: &HttpRequest<AppState>, cube: &Cube) -> (Vec<String>, Vec<
None => ()
}
},
Err(err) => ()
Err(_err) => ()
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tesseract-server/src/handlers/logic_layer/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub fn logic_layer_default_handler(

/// Handles aggregation when a format is specified.
pub fn logic_layer_handler(
(req, cube_format): (HttpRequest<AppState>, Path<(String)>)
(req, cube_format): (HttpRequest<AppState>, Path<String>)
) -> FutureResponse<HttpResponse>
{
logic_layer_aggregation(req, cube_format.to_owned())
Expand Down
2 changes: 1 addition & 1 deletion tesseract-server/src/handlers/logic_layer/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub fn logic_layer_members_default_handler(

/// Handles members query when a format is specified.
pub fn logic_layer_members_handler(
(req, cube_format): (HttpRequest<AppState>, Path<(String)>)
(req, cube_format): (HttpRequest<AppState>, Path<String>)
) -> FutureResponse<HttpResponse>
{
get_members(req, cube_format.to_owned())
Expand Down
4 changes: 2 additions & 2 deletions tesseract-server/src/handlers/logic_layer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub fn logic_layer_non_unique_levels_default_handler(


pub fn logic_layer_non_unique_levels_handler(
(req, _cube): (HttpRequest<AppState>, Path<(String)>),
(req, _cube): (HttpRequest<AppState>, Path<String>),
) -> HttpResponse
{
if req.state().debug {
Expand Down Expand Up @@ -71,7 +71,7 @@ pub fn logic_layer_relations_non_unique_levels_default_handler(


pub fn logic_layer_relations_non_unique_levels_handler(
(req, _cube): (HttpRequest<AppState>, Path<(String)>),
(req, _cube): (HttpRequest<AppState>, Path<String>),
) -> HttpResponse
{
if req.state().debug {
Expand Down
2 changes: 1 addition & 1 deletion tesseract-server/src/handlers/logic_layer/relations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub fn logic_layer_relations_default_handler(

/// Handles aggregation when a format is specified.
pub fn logic_layer_relations_handler(
(req, cube_format): (HttpRequest<AppState>, Path<(String)>)
(req, cube_format): (HttpRequest<AppState>, Path<String>)
) -> ActixResult<HttpResponse>
{
logic_layer_relations(req, cube_format.to_owned())
Expand Down