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

[Deps] Update criterion to v0.5 #64

Merged
merged 2 commits into from
Aug 20, 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
2 changes: 1 addition & 1 deletion cstree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ m_lexer = "0.0.4"
serde_json = "1.0"
serde_test = "1.0"
crossbeam-utils = "0.8"
criterion = "0.3"
criterion = { version = "0.5.1", features = ["html_reports"] }

[[bench]]
name = "main"
Expand Down
10 changes: 5 additions & 5 deletions cstree/src/getting_started.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
//! to happen to go from input text to a `cstree` syntax tree:
//!
//! 1. Define an enumeration of the types of tokens (like keywords) and nodes (like "an expression") that you want to
//! have in your syntax and implement [`Syntax`]
//! have in your syntax and implement [`Syntax`]
//!
//! 2. Create a [`GreenNodeBuilder`](crate::build::GreenNodeBuilder) and call
//! [`start_node`](crate::build::GreenNodeBuilder::start_node), [`token`](crate::build::GreenNodeBuilder::token) and
//! [`finish_node`](crate::build::GreenNodeBuilder::finish_node) from your parser
//! [`start_node`](crate::build::GreenNodeBuilder::start_node), [`token`](crate::build::GreenNodeBuilder::token) and
//! [`finish_node`](crate::build::GreenNodeBuilder::finish_node) from your parser
//!
//! 3. Call [`SyntaxNode::new_root`](crate::syntax::SyntaxNode::new_root) or
//! [`SyntaxNode::new_root_with_resolver`](crate::syntax::SyntaxNode::new_root_with_resolver) with the resulting
//! [`GreenNode`](crate::green::GreenNode) to obtain a syntax tree that you can traverse
//! [`SyntaxNode::new_root_with_resolver`](crate::syntax::SyntaxNode::new_root_with_resolver) with the resulting
//! [`GreenNode`](crate::green::GreenNode) to obtain a syntax tree that you can traverse
//!
//! Let's walk through the motions of parsing a (very) simple language into `cstree` syntax trees.
//! We'll just support addition and subtraction on integers, from which the user is allowed to construct a single,
Expand Down
4 changes: 2 additions & 2 deletions cstree/src/green/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl PackedGreenElement {

pub(crate) fn into_node(self) -> Option<GreenNode> {
if self.is_node() {
unsafe { Some(mem::transmute(self)) }
unsafe { Some(mem::transmute::<Self, GreenNode>(self)) }
} else {
None
}
Expand All @@ -147,7 +147,7 @@ impl PackedGreenElement {

pub(crate) fn into_token(self) -> Option<GreenToken> {
if !self.is_node() {
unsafe { Some(mem::transmute(self)) }
unsafe { Some(mem::transmute::<Self, GreenToken>(self)) }
} else {
None
}
Expand Down
16 changes: 10 additions & 6 deletions cstree/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@
//! to happen to go from input text to a `cstree` syntax tree:
//!
//! 1. Define an enumeration of the types of tokens (like keywords) and nodes (like "an expression") that you want to
//! have in your syntax and implement [`Syntax`]
//! have in your syntax and implement [`Syntax`]
//!
//! 2. Create a [`GreenNodeBuilder`](build::GreenNodeBuilder) and call
//! [`start_node`](build::GreenNodeBuilder::start_node), [`token`](build::GreenNodeBuilder::token) and
//! [`finish_node`](build::GreenNodeBuilder::finish_node) from your parser
//! [`start_node`](build::GreenNodeBuilder::start_node), [`token`](build::GreenNodeBuilder::token) and
//! [`finish_node`](build::GreenNodeBuilder::finish_node) from your parser
//!
//! 3. Call [`SyntaxNode::new_root`](syntax::SyntaxNode::new_root) or
//! [`SyntaxNode::new_root_with_resolver`](syntax::SyntaxNode::new_root_with_resolver) with the resulting
//! [`GreenNode`](green::GreenNode) to obtain a syntax tree that you can traverse
//! [`SyntaxNode::new_root_with_resolver`](syntax::SyntaxNode::new_root_with_resolver) with the resulting
//! [`GreenNode`](green::GreenNode) to obtain a syntax tree that you can traverse
//!
//! There's a full [getting started guide] that walks through each of the above steps in detail in the documentation for
//! the `getting_started` module. The walkthrough goes through the necessary steps bit by bit and skips the lexer, but
Expand All @@ -86,7 +86,11 @@

#![forbid(missing_debug_implementations, unconditional_recursion)]
#![deny(unsafe_code, future_incompatible)]
#![allow(unstable_name_collisions)] // strict provenance - must come after `future_incompatible` to take precedence
#![allow(
unstable_name_collisions, // strict provenance - must come after `future_incompatible` to take precedence
unexpected_cfgs, // nightly docs.rs features and `salsa-2022` feature until that is figured out
clippy::duplicated_attributes, // interning modules
)]
#![warn(missing_docs)]
// Docs.rs
#![doc(html_root_url = "https://docs.rs/cstree/0.12.0")]
Expand Down
1 change: 1 addition & 0 deletions cstree/src/syntax/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ impl<S: Syntax, D> SyntaxNode<S, D> {
}

/// Returns the data associated with this node, if any.
#[allow(clippy::useless_asref)] // make `Arc::clone` explicit
pub fn get_data(&self) -> Option<Arc<D>> {
let ptr = self.data().data.read();
(*ptr).as_ref().map(Arc::clone)
Expand Down
Loading