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

Fix build & advisory issues. #521

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions .github/workflows/ci_build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
- name: Rust Toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-08-06
toolchain: nightly-2024-10-17
- uses: actions/cache@v3
id: restore-build
with:
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
- name: Rust Toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-08-06
toolchain: nightly-2024-10-17
- uses: actions/cache@v3
id: restore-build-and-conformance
with:
Expand Down
3 changes: 2 additions & 1 deletion about.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ accepted = [
"ISC",
"Zlib",
"ICU",
"Unicode-DFS-2016"
"Unicode-DFS-2016",
"Unicode-3.0"
]
2 changes: 1 addition & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ allow = [
# If you change this list, please also change `about.toml`
# see https://github.com/EmbarkStudios/cargo-about/issues/201
exceptions = [
{ allow = ["Unicode-DFS-2016"], name = "unicode-ident" },
{ allow = ["Unicode-DFS-2016", "Unicode-3.0"], name = "unicode-ident" },
]

# The confidence threshold for detecting a license from license text.
Expand Down
2 changes: 1 addition & 1 deletion extension/partiql-extension-ion/src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pub struct IonValueIter<'a> {
inner: Box<dyn Iterator<Item = IonDecodeResult> + 'a>,
}

impl<'a> Iterator for IonValueIter<'a> {
impl Iterator for IonValueIter<'_> {
type Item = IonDecodeResult;

#[inline]
Expand Down
2 changes: 1 addition & 1 deletion partiql-ast-passes/src/name_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ impl<'c> NameResolver<'c> {
}
}

impl<'ast, 'c> Visitor<'ast> for NameResolver<'c> {
impl<'ast> Visitor<'ast> for NameResolver<'_> {
fn enter_ast_node(&mut self, id: NodeId) -> Traverse {
self.id_path_to_root.push(id);
if let Some(children) = self.id_child_stack.last_mut() {
Expand Down
2 changes: 1 addition & 1 deletion partiql-eval/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub mod basic {
}
}

impl<'a, T> Bindings<T> for NestedBindings<'a, T>
impl<T> Bindings<T> for NestedBindings<'_, T>
where
T: Debug,
{
Expand Down
12 changes: 6 additions & 6 deletions partiql-eval/src/eval/evaluable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ impl AggregateFunction for Max {
}

fn finalize(&self, state: Option<Value>) -> Result<Value, EvaluationError> {
Ok(state.unwrap_or_else(|| Null))
Ok(state.unwrap_or(Null))
}
}

Expand All @@ -515,7 +515,7 @@ impl AggregateFunction for Min {
}

fn finalize(&self, state: Option<Value>) -> Result<Value, EvaluationError> {
Ok(state.unwrap_or_else(|| Null))
Ok(state.unwrap_or(Null))
}
}

Expand All @@ -532,7 +532,7 @@ impl AggregateFunction for Sum {
}

fn finalize(&self, state: Option<Value>) -> Result<Value, EvaluationError> {
Ok(state.unwrap_or_else(|| Null))
Ok(state.unwrap_or(Null))
}
}

Expand All @@ -559,7 +559,7 @@ impl AggregateFunction for Any {
}

fn finalize(&self, state: Option<Value>) -> Result<Value, EvaluationError> {
Ok(state.unwrap_or_else(|| Null))
Ok(state.unwrap_or(Null))
}
}

Expand All @@ -586,7 +586,7 @@ impl AggregateFunction for Every {
}

fn finalize(&self, state: Option<Value>) -> Result<Value, EvaluationError> {
Ok(state.unwrap_or_else(|| Null))
Ok(state.unwrap_or(Null))
}
}

Expand Down Expand Up @@ -1278,7 +1278,7 @@ pub(crate) struct EvalSink {

impl Evaluable for EvalSink {
fn evaluate<'a, 'c>(&mut self, _ctx: &'c dyn EvalContext<'c>) -> Value {
self.input.take().unwrap_or_else(|| Missing)
self.input.take().unwrap_or(Missing)
}

fn update_input(&mut self, input: Value, _branch_num: u8, _ctx: &dyn EvalContext<'_>) {
Expand Down
4 changes: 2 additions & 2 deletions partiql-eval/src/eval/expr/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl EvalExpr for EvalPath {
.try_fold(owned, |v, path| path.take_val(v, bindings, ctx))
.map(Cow::Owned),
}
.unwrap_or_else(|| Cow::Owned(Value::Missing))
.unwrap_or(Cow::Owned(Value::Missing))
}
}

Expand All @@ -165,7 +165,7 @@ impl EvalExpr for EvalDynamicLookup {
}
});

lookups.next().unwrap_or_else(|| Cow::Owned(Value::Missing))
lookups.next().unwrap_or(Cow::Owned(Value::Missing))
}
}

Expand Down
6 changes: 3 additions & 3 deletions partiql-eval/src/eval/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
/// Represents result of evaluation as an evaluated entity.
#[non_exhaustive]
#[derive(Debug)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]

Check warning on line 149 in partiql-eval/src/eval/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

unexpected `cfg` condition value: `serde`

warning: unexpected `cfg` condition value: `serde` --> partiql-eval/src/eval/mod.rs:149:12 | 149 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] | ^^^^^^^^^^^^^^^^^ help: remove the condition | = note: no expected values for `feature` = help: consider adding `serde` as a feature in `Cargo.toml` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default
pub struct Evaluated {
pub result: Value,
}
Expand All @@ -170,7 +170,7 @@
pub errors: RefCell<Vec<EvaluationError>>,
}

impl<'a> BasicContext<'a> {
impl BasicContext<'_> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems unrelated to your change but there's a clippy warning on L149:

unexpected `cfg` condition value: `serde`

warning: unexpected `cfg` condition value: `serde`
   --> partiql-eval/src/eval/mod.rs:149:12
    |
149 | #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
    |            ^^^^^^^^^^^^^^^^^ help: remove the condition
    |
    = note: no expected values for `feature`
    = help: consider adding `serde` as a feature in `Cargo.toml`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
    = note: `#[warn(unexpected_cfgs)]` on by default

#[must_use]
pub fn new(bindings: MapBindings<Value>, sys: SystemContext) -> Self {
BasicContext {
Expand Down Expand Up @@ -228,7 +228,7 @@
}
}

impl<'a, 'c> SessionContext<'a> for NestedContext<'a, 'c> {
impl<'a> SessionContext<'a> for NestedContext<'a, '_> {
fn bindings(&self) -> &dyn Bindings<Value> {
&self.bindings
}
Expand All @@ -241,7 +241,7 @@
}
}

impl<'a, 'c> EvalContext<'a> for NestedContext<'a, 'c> {
impl<'a> EvalContext<'a> for NestedContext<'a, '_> {
fn as_session(&'a self) -> &'a dyn SessionContext<'a> {
self
}
Expand Down
4 changes: 2 additions & 2 deletions partiql-logical-planner/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub(crate) trait Function {
fn resolve(&self, name: &str, args: &[CallArgument]) -> Result<ValueExpr, CallLookupError>;
}

impl<'a> Function for FunctionEntry<'a> {
impl Function for FunctionEntry<'_> {
fn resolve(&self, name: &str, args: &[CallArgument]) -> Result<ValueExpr, CallLookupError> {
let oid = self.id();
match self.entry() {
Expand All @@ -30,7 +30,7 @@ struct ScalarFnResolver<'a> {
pub scfn: &'a ScalarFnCallSpecs,
}

impl<'a> Function for ScalarFnResolver<'a> {
impl Function for ScalarFnResolver<'_> {
fn resolve(&self, name: &str, args: &[CallArgument]) -> Result<ValueExpr, CallLookupError> {
let oid = self.oid;
let overloads = self.scfn;
Expand Down
2 changes: 1 addition & 1 deletion partiql-logical-planner/src/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ impl<'a> AstToLogical<'a> {
// so there is nothing done between the `enter_<x>` and `exit_<x>` calls.
// By convention, processing for them is done in the `enter_<x>` calls here.
//
impl<'a, 'ast> Visitor<'ast> for AstToLogical<'a> {
impl<'ast> Visitor<'ast> for AstToLogical<'_> {
fn enter_ast_node(&mut self, id: NodeId) -> Traverse {
self.id_stack.push(id);
Traverse::Continue
Expand Down
2 changes: 1 addition & 1 deletion partiql-parser/src/lexer/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl<'input, 'tracker> CommentLexer<'input, 'tracker> {
}
}

impl<'input, 'tracker> Iterator for CommentLexer<'input, 'tracker> {
impl<'input> Iterator for CommentLexer<'input, '_> {
type Item = CommentStringResult<'input>;

#[inline(always)]
Expand Down
2 changes: 1 addition & 1 deletion partiql-parser/src/lexer/embedded_ion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl<'input, 'tracker> EmbeddedIonLexer<'input, 'tracker> {
}
}

impl<'input, 'tracker> Iterator for EmbeddedIonLexer<'input, 'tracker> {
impl<'input> Iterator for EmbeddedIonLexer<'input, '_> {
type Item = EmbeddedIonStringResult<'input>;

#[inline(always)]
Expand Down
6 changes: 3 additions & 3 deletions partiql-parser/src/lexer/partiql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl<'input, 'tracker> PartiqlLexer<'input, 'tracker> {
}
}

impl<'input, 'tracker> Iterator for PartiqlLexer<'input, 'tracker> {
impl<'input> Iterator for PartiqlLexer<'input, '_> {
type Item = LexResult<'input>;

#[inline(always)]
Expand Down Expand Up @@ -382,7 +382,7 @@ pub enum Token<'input> {
Zone,
}

impl<'input> Token<'input> {
impl Token<'_> {
pub fn is_keyword(&self) -> bool {
matches!(
self,
Expand Down Expand Up @@ -449,7 +449,7 @@ impl<'input> Token<'input> {
}
}

impl<'input> fmt::Display for Token<'input> {
impl fmt::Display for Token<'_> {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
match self {
Token::Newline => write!(f, "\\n"),
Expand Down
6 changes: 3 additions & 3 deletions partiql-parser/src/parse/parser_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub(crate) struct ParserState<'input, Id: NodeIdGenerator> {
aggregates_pat: &'static Regex,
}

impl<'input> Default for ParserState<'input, AutoNodeIdGenerator> {
impl Default for ParserState<'_, AutoNodeIdGenerator> {
fn default() -> Self {
ParserState::with_id_gen(AutoNodeIdGenerator::default())
}
Expand All @@ -44,7 +44,7 @@ const KNOWN_AGGREGATES: &str =
"(?i:^count$)|(?i:^avg$)|(?i:^min$)|(?i:^max$)|(?i:^sum$)|(?i:^any$)|(?i:^some$)|(?i:^every$)";
static KNOWN_AGGREGATE_PATTERN: Lazy<Regex> = Lazy::new(|| Regex::new(KNOWN_AGGREGATES).unwrap());

impl<'input, I> ParserState<'input, I>
impl<I> ParserState<'_, I>
where
I: NodeIdGenerator,
{
Expand All @@ -58,7 +58,7 @@ where
}
}

impl<'input, IdGen: NodeIdGenerator> ParserState<'input, IdGen> {
impl<IdGen: NodeIdGenerator> ParserState<'_, IdGen> {
/// Create a new [`AstNode`] from the inner data which it is to hold and a source location.
pub fn create_node<T, IntoLoc>(&mut self, node: T, location: IntoLoc) -> AstNode<T>
where
Expand Down
2 changes: 1 addition & 1 deletion partiql-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ thiserror = "1"

indexmap = "2.5"

derivative = "2.2"
educe = "0.6"

[dev-dependencies]
28 changes: 14 additions & 14 deletions partiql-types/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![deny(rust_2018_idioms)]
#![deny(clippy::all)]

use derivative::Derivative;
use educe::Educe;
use indexmap::IndexSet;
use itertools::Itertools;
use miette::Diagnostic;
Expand Down Expand Up @@ -584,11 +584,11 @@ impl PartiqlShapeBuilder {
}
}

#[derive(Derivative, Eq, Debug, Clone)]
#[derivative(PartialEq, Hash)]
#[derive(Educe, Eq, Debug, Clone)]
#[educe(PartialEq, Hash)]
#[allow(dead_code)]
pub struct AnyOf {
#[derivative(Hash(hash_with = "indexset_hash"))]
#[educe(Hash(method(indexset_hash)))]
types: IndexSet<PartiqlShape>,
}

Expand Down Expand Up @@ -743,11 +743,11 @@ impl Display for Static {

pub const TYPE_DYNAMIC: PartiqlShape = PartiqlShape::Dynamic;

#[derive(Derivative, Eq, Debug, Clone)]
#[derivative(PartialEq, Hash)]
#[derive(Educe, Eq, Debug, Clone)]
#[educe(PartialEq, Hash)]
#[allow(dead_code)]
pub struct StructType {
#[derivative(Hash(hash_with = "indexset_hash"))]
#[educe(Hash(method(indexset_hash)))]
constraints: IndexSet<StructConstraint>,
}

Expand Down Expand Up @@ -827,15 +827,15 @@ impl Display for StructType {
}
}

#[derive(Derivative, Eq, Debug, Clone)]
#[derivative(PartialEq, Hash)]
#[derive(Educe, Eq, Debug, Clone)]
#[educe(PartialEq, Hash)]
#[allow(dead_code)]
#[non_exhaustive]
pub enum StructConstraint {
Open(bool),
Ordered(bool),
DuplicateAttrs(bool),
Fields(#[derivative(Hash(hash_with = "indexset_hash"))] IndexSet<StructField>),
Fields(#[educe(Hash(method(indexset_hash)))] IndexSet<StructField>),
}

#[derive(Debug, Clone, Hash, Eq, PartialEq)]
Expand Down Expand Up @@ -901,8 +901,8 @@ impl From<(&str, PartiqlShape, bool)> for StructField {
}
}

#[derive(Derivative, Eq, Debug, Clone)]
#[derivative(PartialEq, Hash)]
#[derive(Educe, Eq, Debug, Clone)]
#[educe(PartialEq, Hash)]
#[allow(dead_code)]
pub struct BagType {
element_type: Box<PartiqlShape>,
Expand Down Expand Up @@ -938,8 +938,8 @@ impl Display for BagType {
}
}

#[derive(Derivative, Eq, Debug, Clone)]
#[derivative(PartialEq, Hash)]
#[derive(Educe, Eq, Debug, Clone)]
#[educe(PartialEq, Hash)]
#[allow(dead_code)]
pub struct ArrayType {
element_type: Box<PartiqlShape>,
Expand Down
2 changes: 1 addition & 1 deletion partiql-value/src/bag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ impl PartialOrd for Bag {
}
}

impl<'a, const NULLS_FIRST: bool> Ord for NullSortedValue<'a, NULLS_FIRST, Bag> {
impl<const NULLS_FIRST: bool> Ord for NullSortedValue<'_, NULLS_FIRST, Bag> {
fn cmp(&self, other: &Self) -> Ordering {
let wrap = NullSortedValue::<{ NULLS_FIRST }, List>;

Expand Down
4 changes: 2 additions & 2 deletions partiql-value/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ pub trait NullableOrd {
#[derive(Eq, PartialEq)]
pub struct EqualityValue<'a, const NULLS_EQUAL: bool, T>(pub &'a T);

impl<'a, const GROUP_NULLS: bool> NullableEq for EqualityValue<'a, GROUP_NULLS, Value> {
impl<const GROUP_NULLS: bool> NullableEq for EqualityValue<'_, GROUP_NULLS, Value> {
type Output = Value;

fn eq(&self, rhs: &Self) -> Self::Output {
Expand Down Expand Up @@ -905,7 +905,7 @@ where
}
}

impl<'a, const NULLS_FIRST: bool> Ord for NullSortedValue<'a, NULLS_FIRST, Value> {
impl<const NULLS_FIRST: bool> Ord for NullSortedValue<'_, NULLS_FIRST, Value> {
fn cmp(&self, other: &Self) -> Ordering {
let wrap_list = NullSortedValue::<{ NULLS_FIRST }, List>;
let wrap_tuple = NullSortedValue::<{ NULLS_FIRST }, Tuple>;
Expand Down
2 changes: 1 addition & 1 deletion partiql-value/src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ impl PartialOrd for List {
}
}

impl<'a, const NULLS_FIRST: bool> Ord for NullSortedValue<'a, NULLS_FIRST, List> {
impl<const NULLS_FIRST: bool> Ord for NullSortedValue<'_, NULLS_FIRST, List> {
fn cmp(&self, other: &Self) -> Ordering {
let wrap = NullSortedValue::<{ NULLS_FIRST }, _>;

Expand Down
2 changes: 1 addition & 1 deletion partiql-value/src/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl PrettyDoc for Tuple {

pub struct StructValuePair<'a>((&'a String, &'a Value));

impl<'a> PrettyDoc for StructValuePair<'a> {
impl PrettyDoc for StructValuePair<'_> {
fn pretty_doc<'b, D, A>(&'b self, arena: &'b D) -> DocBuilder<'b, D, A>
where
D: DocAllocator<'b, A>,
Expand Down
Loading
Loading