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

Check fix clippy lint in test #117

Merged
merged 1 commit into from
Feb 15, 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
10 changes: 5 additions & 5 deletions crates/oq3_lexer/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
use super::*;

use expect_test::{expect, Expect};
use std::fmt::Write;

// FIXME: Probably do what clippy asks for here
#[allow(clippy::format_collect)]
fn check_lexing(src: &str, expect: Expect) {
let actual: String = tokenize(src)
.map(|token| format!("{:?}\n", token))
.collect();
let actual: String = tokenize(src).fold(String::new(), |mut output, token| {
let _ = writeln!(output, "{token:?}");
output
});
expect.assert_eq(&actual)
}

Expand Down
2 changes: 1 addition & 1 deletion crates/oq3_semantics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ doctest = false
[dependencies]
oq3_source_file.workspace = true
oq3_syntax.workspace = true
hashbrown = { version = "0.14" }
hashbrown = { version = "0.12.3" }
rowan = "0.15.11"
boolenum = "0.1"

Expand Down
1 change: 1 addition & 0 deletions crates/oq3_syntax/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ smol_str = "0.2.0"
stdx = { version = "0.0.188", package = "ra_ap_stdx"}
triomphe = { version = "0.1.8", default-features = false, features = ["std"] }
xshell = "0.2.2"
rustversion = "1.0"
# local crates
oq3_lexer.workspace = true
oq3_parser.workspace = true
Expand Down
14 changes: 14 additions & 0 deletions crates/oq3_syntax/src/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ pub struct AstPtr<N: AstNode> {
}

impl<N: AstNode> Clone for AstPtr<N> {
#[rustversion::before(1.74)]
fn clone(&self) -> AstPtr<N> {
AstPtr {
raw: self.raw.clone(),
_ty: PhantomData,
}
}
#[rustversion::since(1.74)]
fn clone(&self) -> AstPtr<N> {
AstPtr {
raw: self.raw,
Expand Down Expand Up @@ -67,10 +75,16 @@ impl<N: AstNode> AstPtr<N> {
N::cast(syntax_node).unwrap()
}

#[rustversion::since(1.74)]
pub fn syntax_node_ptr(&self) -> SyntaxNodePtr {
self.raw
}

#[rustversion::before(1.74)]
pub fn syntax_node_ptr(&self) -> SyntaxNodePtr {
self.raw.clone()
}

pub fn text_range(&self) -> TextRange {
self.raw.text_range()
}
Expand Down
Loading