From cdc3bc6bde3b7d4f6e6572b922432352d8ea3585 Mon Sep 17 00:00:00 2001 From: Greg Burd Date: Fri, 24 Nov 2023 17:35:42 +0000 Subject: [PATCH] WIP --- Cargo.toml | 4 ++-- Makefile | 2 ++ build/version.rs | 2 +- edn/src/query.rs | 4 ++-- edn/src/types.rs | 2 +- edn/src/utils.rs | 2 +- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 735aee39..d85558d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -edition = "2018" +edition = "2021" authors = [ "Richard Newman ", "Nicholas Alexander ", @@ -14,7 +14,7 @@ authors = [ "Gregory Burd ", ] name = "mentat" -version = "0.13.0" +version = "0.14.0" build = "build/version.rs" [features] diff --git a/Makefile b/Makefile index b9a0a584..d718bf76 100644 --- a/Makefile +++ b/Makefile @@ -6,3 +6,5 @@ outdated: fix: $(for p in $(dirname $(ls Cargo.toml */Cargo.toml */*/Cargo.toml)); do echo $p; (cd $p; cargo fix --allow-dirty --broken-code --edition-idioms); done) +upgrades: + cargo upgrades diff --git a/build/version.rs b/build/version.rs index d5aa81a3..0b14f826 100644 --- a/build/version.rs +++ b/build/version.rs @@ -14,7 +14,7 @@ use std::process::exit; /// MIN_VERSION should be changed when there's a new minimum version of rustc required /// to build the project. -static MIN_VERSION: &str = "1.43.0"; +static MIN_VERSION: &str = "1.69.0"; fn main() { let ver = version().unwrap(); diff --git a/edn/src/query.rs b/edn/src/query.rs index c2aaa185..dde4e91b 100644 --- a/edn/src/query.rs +++ b/edn/src/query.rs @@ -1028,8 +1028,8 @@ impl ParsedQuery { Ok(ParsedQuery { find_spec: find_spec.ok_or("expected :find")?, default_source: SrcVar::DefaultSrc, - with: with.unwrap_or_else(Vec::new), // - in_vars: in_vars.unwrap_or_else(Vec::new), + with: with.unwrap_or_default(), + in_vars: in_vars.unwrap_or_default(), in_sources: BTreeSet::default(), limit: limit.unwrap_or(Limit::None), where_clauses: where_clauses.ok_or("expected :where")?, diff --git a/edn/src/types.rs b/edn/src/types.rs index 4ad8f975..beb20878 100644 --- a/edn/src/types.rs +++ b/edn/src/types.rs @@ -690,7 +690,7 @@ pub trait FromMillis { impl FromMillis for DateTime { fn from_millis(ts: i64) -> Self { - Utc.timestamp_opt(ts / 1_000, ((ts % 1_000).abs() as u32) * 1_000).unwrap() + Utc.timestamp_opt(ts / 1_000, ((ts % 1_000).unsigned_abs() as u32) * 1_000).unwrap() } } diff --git a/edn/src/utils.rs b/edn/src/utils.rs index 61b1177b..e9338633 100644 --- a/edn/src/utils.rs +++ b/edn/src/utils.rs @@ -21,7 +21,7 @@ use crate::types::Value; /// TODO: implement `merge` for [Value], following the `concat`/`SliceConcatExt` pattern. pub fn merge(left: &Value, right: &Value) -> Option { match (left, right) { - (&Value::Map(ref l), &Value::Map(ref r)) => { + (Value::Map(l), Value::Map(r)) => { let mut result = l.clone(); result.extend(r.clone()); Some(Value::Map(result))