Updated compiler and dependencies
* Upgraded to rustc 1.80 * Updated dependencies * Fixed most linter warnings
This commit is contained in:
16
Cargo.toml
16
Cargo.toml
@@ -33,19 +33,19 @@ required-features = ["bin"]
|
|||||||
bin = ["measure_time", "pretty_env_logger"]
|
bin = ["measure_time", "pretty_env_logger"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
mercator_db = "^0.1"
|
mercator_db = "0.1"
|
||||||
|
|
||||||
lalrpop-util = "^0.17"
|
lalrpop-util = "0.20"
|
||||||
regex = "^1.2"
|
regex = "1.10"
|
||||||
|
|
||||||
# Logging macros API
|
# Logging macros API
|
||||||
#log = { version = "^0.4", features = ["max_level_trace", "release_max_level_info"] }
|
#log = { version = "0.4", features = ["max_level_trace", "release_max_level_info"] }
|
||||||
log = { version = "^0.4", features = ["max_level_trace", "release_max_level_trace"] }
|
log = { version = "0.4", features = ["max_level_trace", "release_max_level_trace"] }
|
||||||
|
|
||||||
# Used for main.rs
|
# Used for main.rs
|
||||||
pretty_env_logger = { version = "^0.3", optional = true } # Logger implementation
|
pretty_env_logger = { version = "0.5", optional = true } # Logger implementation
|
||||||
measure_time = { version = "^0.6", optional = true } # To mesure parsing time, only required by binary
|
measure_time = { version = "0.8", optional = true } # To mesure parsing time, only required by binary
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
lalrpop = "^0.17.1"
|
lalrpop = "0.20"
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.42.0"
|
channel = "1.80.0"
|
||||||
|
|||||||
@@ -38,12 +38,10 @@ fn complement_helper<'c>(
|
|||||||
|
|
||||||
Ok(points
|
Ok(points
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|(space, v)| match hashmap.get(space) {
|
.filter_map(|(space, v)|
|
||||||
None => None,
|
hashmap.get(space).map(|list|
|
||||||
Some(list) => {
|
(space, v.into_iter().filter(|t|
|
||||||
Some((space, v.into_iter().filter(|t| !list.contains(t)).collect()))
|
!list.contains(t)).collect())))
|
||||||
}
|
|
||||||
})
|
|
||||||
.collect::<Vec<_>>())
|
.collect::<Vec<_>>())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,7 +72,7 @@ fn distinct<'c>(
|
|||||||
e @ Err(_) => e,
|
e @ Err(_) => e,
|
||||||
Ok(mut v) => {
|
Ok(mut v) => {
|
||||||
let set: HashSet<_> = v.drain(..).collect(); // dedup
|
let set: HashSet<_> = v.drain(..).collect(); // dedup
|
||||||
v.extend(set.into_iter());
|
v.extend(set);
|
||||||
|
|
||||||
Ok(v)
|
Ok(v)
|
||||||
}
|
}
|
||||||
@@ -318,7 +316,7 @@ fn outside<'c>(
|
|||||||
// Smallest increment possible
|
// Smallest increment possible
|
||||||
let mut increment = Vec::with_capacity(bounding_box[0].dimensions());
|
let mut increment = Vec::with_capacity(bounding_box[0].dimensions());
|
||||||
for _ in 0..bounding_box[0].dimensions() {
|
for _ in 0..bounding_box[0].dimensions() {
|
||||||
increment.push(std::f64::EPSILON);
|
increment.push(f64::EPSILON);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add it to the lower bound
|
// Add it to the lower bound
|
||||||
@@ -337,7 +335,7 @@ fn outside<'c>(
|
|||||||
Shape::HyperSphere(space_id, center, radius) => {
|
Shape::HyperSphere(space_id, center, radius) => {
|
||||||
// Smallest decrement possible, to exclude the surface
|
// Smallest decrement possible, to exclude the surface
|
||||||
let mut radius: f64 = radius.into();
|
let mut radius: f64 = radius.into();
|
||||||
radius -= std::f64::EPSILON;
|
radius -= f64::EPSILON;
|
||||||
let center: space::Position = center.into();
|
let center: space::Position = center.into();
|
||||||
|
|
||||||
match core.get_by_shape(
|
match core.get_by_shape(
|
||||||
@@ -364,7 +362,7 @@ impl<'e> Executor<'e> for Projection {
|
|||||||
) -> Self::ResultSet {
|
) -> Self::ResultSet {
|
||||||
match self {
|
match self {
|
||||||
Projection::Nifti(_, _, _bag) => Err("Proj-Nifti: not yet implemented".to_string()),
|
Projection::Nifti(_, _, _bag) => Err("Proj-Nifti: not yet implemented".to_string()),
|
||||||
Projection::JSON(_, _format, bag) => {
|
Projection::Json(_, _format, bag) => {
|
||||||
bag.execute(core_id, parameters)
|
bag.execute(core_id, parameters)
|
||||||
// FIXME: Add projections here
|
// FIXME: Add projections here
|
||||||
}
|
}
|
||||||
|
|||||||
14
src/lib.rs
14
src/lib.rs
@@ -38,20 +38,20 @@ lalrpop_mod!(#[allow(clippy::all,unused_parens)] pub queries); // synthesized by
|
|||||||
// as well.
|
// as well.
|
||||||
// Instead we enable it per modules below, except for the tests.
|
// Instead we enable it per modules below, except for the tests.
|
||||||
|
|
||||||
#[warn(missing_docs)]
|
//#[warn(missing_docs)]
|
||||||
mod evaluators;
|
mod evaluators;
|
||||||
#[warn(missing_docs)]
|
//#[warn(missing_docs)]
|
||||||
mod executors;
|
mod executors;
|
||||||
#[warn(missing_docs)]
|
//#[warn(missing_docs)]
|
||||||
mod expressions;
|
mod expressions;
|
||||||
#[warn(missing_docs)]
|
//#[warn(missing_docs)]
|
||||||
mod predictors;
|
mod predictors;
|
||||||
#[warn(missing_docs)]
|
//#[warn(missing_docs)]
|
||||||
mod validators;
|
mod validators;
|
||||||
|
|
||||||
#[warn(missing_docs)]
|
//#[warn(missing_docs)]
|
||||||
mod symbols;
|
mod symbols;
|
||||||
#[warn(missing_docs)]
|
//#[warn(missing_docs)]
|
||||||
mod types;
|
mod types;
|
||||||
|
|
||||||
pub use expressions::Executor;
|
pub use expressions::Executor;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ impl Predictor for Projection {
|
|||||||
fn predict(&self, db: &DataBase) -> Result<f64, String> {
|
fn predict(&self, db: &DataBase) -> Result<f64, String> {
|
||||||
match self {
|
match self {
|
||||||
Projection::Nifti(_, _, bag) => bag.predict(db),
|
Projection::Nifti(_, _, bag) => bag.predict(db),
|
||||||
Projection::JSON(_, _, bag) => bag.predict(db),
|
Projection::Json(_, _, bag) => bag.predict(db),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ JsonOperator: symbols::Projection = {
|
|||||||
None => Space::universe().name().clone(),
|
None => Space::universe().name().clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
symbols::Projection::JSON(space_id, f, b)
|
symbols::Projection::Json(space_id, f, b)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ pub use super::types::*;
|
|||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum Projection {
|
pub enum Projection {
|
||||||
Nifti(String, LiteralSelector, Bag),
|
Nifti(String, LiteralSelector, Bag),
|
||||||
JSON(String, JsonValue, Bag),
|
Json(String, JsonValue, Bag),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Projection {
|
impl Projection {
|
||||||
pub fn space(&self) -> &String {
|
pub fn space(&self) -> &String {
|
||||||
match self {
|
match self {
|
||||||
Projection::Nifti(space, _, _) => &space,
|
Projection::Nifti(space, _, _) => space,
|
||||||
Projection::JSON(space, _, _) => &space,
|
Projection::Json(space, _, _) => space,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,7 @@ impl Shape {
|
|||||||
|
|
||||||
pub fn volume(&self) -> f64 {
|
pub fn volume(&self) -> f64 {
|
||||||
match self {
|
match self {
|
||||||
Shape::Point(_, _) => std::f64::EPSILON, // The smallest non-zero volume possible
|
Shape::Point(_, _) => f64::EPSILON, // The smallest non-zero volume possible
|
||||||
Shape::HyperRectangle(_space, pos) => {
|
Shape::HyperRectangle(_space, pos) => {
|
||||||
//TODO: At this time, only aligned to the axes, defined by two points, hyperrectangles are supported.
|
//TODO: At this time, only aligned to the axes, defined by two points, hyperrectangles are supported.
|
||||||
assert_eq!(pos.len(), 2);
|
assert_eq!(pos.len(), 2);
|
||||||
@@ -208,7 +208,7 @@ impl Shape {
|
|||||||
}
|
}
|
||||||
Shape::Label(_, _) => {
|
Shape::Label(_, _) => {
|
||||||
// FIXME: Needs to find a way to figure out the approximate volume of this specific ID, or return MAX or MIN..
|
// FIXME: Needs to find a way to figure out the approximate volume of this specific ID, or return MAX or MIN..
|
||||||
std::f64::EPSILON
|
f64::EPSILON
|
||||||
}
|
}
|
||||||
Shape::Nifti(_) => unimplemented!("Nifti"),
|
Shape::Nifti(_) => unimplemented!("Nifti"),
|
||||||
}
|
}
|
||||||
|
|||||||
21
src/types.rs
21
src/types.rs
@@ -11,23 +11,10 @@ pub enum LiteralTypes {
|
|||||||
impl PartialEq for LiteralTypes {
|
impl PartialEq for LiteralTypes {
|
||||||
fn eq(&self, other: &Self) -> bool {
|
fn eq(&self, other: &Self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
LiteralTypes::String => match other {
|
LiteralTypes::String => matches!(other, LiteralTypes::String),
|
||||||
LiteralTypes::String => true,
|
LiteralTypes::Int => matches!(other, LiteralTypes::Int),
|
||||||
_ => false,
|
LiteralTypes::Float => matches!(other, LiteralTypes::Float | LiteralTypes::Int),
|
||||||
},
|
LiteralTypes::Bag(_) => matches!(other, LiteralTypes::Bag(_)),
|
||||||
LiteralTypes::Int => match other {
|
|
||||||
LiteralTypes::Int => true,
|
|
||||||
_ => false,
|
|
||||||
},
|
|
||||||
LiteralTypes::Float => match other {
|
|
||||||
LiteralTypes::Float => true,
|
|
||||||
LiteralTypes::Int => true,
|
|
||||||
_ => false,
|
|
||||||
},
|
|
||||||
LiteralTypes::Bag(_) => match other {
|
|
||||||
LiteralTypes::Bag(_) => true,
|
|
||||||
_ => false,
|
|
||||||
},
|
|
||||||
LiteralTypes::Vector(v) => match other {
|
LiteralTypes::Vector(v) => match other {
|
||||||
LiteralTypes::Vector(ov) => {
|
LiteralTypes::Vector(ov) => {
|
||||||
let n = v.len();
|
let n = v.len();
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ impl Validator for Projection {
|
|||||||
fn validate(&self) -> ValidationResult {
|
fn validate(&self) -> ValidationResult {
|
||||||
match self {
|
match self {
|
||||||
Projection::Nifti(_, _, _) => Err("not yet implemented".to_string()),
|
Projection::Nifti(_, _, _) => Err("not yet implemented".to_string()),
|
||||||
Projection::JSON(_, _format, bag) => bag.validate(),
|
Projection::Json(_, _format, bag) => bag.validate(),
|
||||||
//FIXME: Add support for projections
|
//FIXME: Add support for projections
|
||||||
/* match format.validate() {
|
/* match format.validate() {
|
||||||
Ok(_) => bag.validate(),
|
Ok(_) => bag.validate(),
|
||||||
|
|||||||
Reference in New Issue
Block a user