Skip to content
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 .github/workflows/dirsql-rust-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ jobs:
key: ${{ runner.os }}-cargo-stable-${{ hashFiles('Cargo.lock') }}

- name: Clippy
run: cargo clippy --workspace -- -D warnings
run: cargo clippy --workspace --all-targets --features cli -- -D warnings

- name: Format check
run: cargo fmt --all -- --check
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"command": "just test-e2e",
"ran_at": 1789752342,
"exit_code": 0,
"commit": "a597fe5a5b7f4a27b7132385027bc0b71e447138",
"branch": "claude/1148-clippy-all-targets"
}
8 changes: 3 additions & 5 deletions packages/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2259,7 +2259,7 @@ mod readonly_tests {
);
// `watch`, `config`, `matcher` wrap a typed StdError to preserve a
// `source()` chain.
let io = || std::io::Error::new(std::io::ErrorKind::Other, "x");
let io = || std::io::Error::other("x");
let watch_err = DirSqlError::watch(io());
assert_eq!(watch_err.to_string(), "watcher error: x");
assert!(StdError::source(&watch_err).is_some());
Expand Down Expand Up @@ -4273,8 +4273,7 @@ mod internal_tests {
&mut sources,
&mut out,
)
.err()
.expect("duplicate function name must error");
.expect_err("duplicate function name must error");
let msg = err.to_string();
assert!(msg.contains("'dup'"), "got: {msg}");
assert!(msg.contains("/a/frag.toml"), "got: {msg}");
Expand All @@ -4293,8 +4292,7 @@ mod internal_tests {
&mut sources,
&mut out,
)
.err()
.expect("intra-config duplicate must error");
.expect_err("intra-config duplicate must error");
assert!(err.to_string().contains("'dup'"), "got: {err}");
}

Expand Down
4 changes: 1 addition & 3 deletions packages/rust/src/vtab_scaffold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,7 @@ mod tests {

#[test]
fn parse_gitignore_rejects_an_unknown_switch() {
let err = parse_gitignore("sometimes")
.err()
.expect("an unknown switch must be rejected");
let err = parse_gitignore("sometimes").expect_err("an unknown switch must be rejected");
assert!(matches!(err, Error::ModuleError(_)), "got {err:?}");
assert!(err.to_string().contains("no-gitignore"), "got: {err}");
}
Expand Down
23 changes: 12 additions & 11 deletions packages/rust/tests/async_sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,17 +286,18 @@ async fn sync_backed_methods_before_ready_error() {
// matched `gate.txt`. Prove it arrived, then release it and let it finish
// so the background thread does not outlive the TempDir.
let (lock, cvar) = &*gate;
let (mut state, wait) = cvar
.wait_timeout_while(lock.lock().unwrap(), PARK_PATIENCE, |s| !s.parked)
.unwrap();
assert!(
!wait.timed_out(),
"init never reached the extract closure: the scan matched no file, so \
this test never exercised a parked init",
);
state.released = true;
cvar.notify_all();
drop(state);
{
let (mut state, wait) = cvar
.wait_timeout_while(lock.lock().unwrap(), PARK_PATIENCE, |s| !s.parked)
.unwrap();
assert!(
!wait.timed_out(),
"init never reached the extract closure: the scan matched no file, so \
this test never exercised a parked init",
);
state.released = true;
cvar.notify_all();
}
db.ready().await.unwrap();
}

Expand Down
12 changes: 6 additions & 6 deletions packages/rust/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ pub fn build_fixture_extension() -> PathBuf {
let Ok(msg) = serde_json::from_str::<serde_json::Value>(line) else {
continue;
};
if msg["reason"] == "compiler-artifact" {
if let Some(files) = msg["filenames"].as_array() {
for f in files.iter().filter_map(|f| f.as_str()) {
if f.ends_with(".so") || f.ends_with(".dylib") || f.ends_with(".dll") {
artifact = Some(PathBuf::from(f));
}
if msg["reason"] == "compiler-artifact"
&& let Some(files) = msg["filenames"].as_array()
{
for f in files.iter().filter_map(|f| f.as_str()) {
if f.ends_with(".so") || f.ends_with(".dylib") || f.ends_with(".dll") {
artifact = Some(PathBuf::from(f));
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions packages/rust/tests/persist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
//! for files whose filesystem metadata matches the cache.

use dirsql::{DirSQL, DirSqlError, Row, Table, Value};
use rusqlite;
use std::collections::HashMap;
use std::fs;
use std::path::Path;
Expand Down Expand Up @@ -370,7 +369,7 @@ fn dirsql_directory_excluded_when_persist_disabled() {
fn counting_named_table(name: &'static str, col: &'static str, counter: Arc<AtomicUsize>) -> Table {
Table::new(
name,
&format!("CREATE TABLE {name} ({col} TEXT)"),
format!("CREATE TABLE {name} ({col} TEXT)"),
"**/*.csv",
move |path| {
let content = std::fs::read_to_string(path).unwrap();
Expand Down
6 changes: 2 additions & 4 deletions packages/rust/tests/schema_inference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,10 @@ fn a_key_null_in_one_row_takes_its_type_from_another() {

let values: Vec<Option<i64>> = {
let mut stmt = conn.prepare("SELECT n FROM t").unwrap();
let v = stmt
.query_map([], |r| r.get(0))
stmt.query_map([], |r| r.get(0))
.unwrap()
.map(Result::unwrap)
.collect();
v
.collect()
};
assert_eq!(values, vec![None, Some(7)]);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/rust/tests/sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ fn fanout_root() -> TempDir {
fn table_returning(name: &str, glob: &str, col: &'static str, val: &'static str) -> Table {
Table::new(
name,
&format!("CREATE TABLE {name} ({col} TEXT)"),
format!("CREATE TABLE {name} ({col} TEXT)"),
glob,
move |_path| vec![HashMap::from([(col.into(), Value::Text(val.into()))])],
)
Expand Down
8 changes: 4 additions & 4 deletions packages/rust/tests/watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ fn drain_row_events(
seen
}

fn tables_with_action<'a>(
events: &'a [RowEvent],
fn tables_with_action(
events: &[RowEvent],
is_action: impl Fn(&RowEvent) -> Option<&str>,
) -> std::collections::HashSet<&'a str> {
events.iter().filter_map(|e| is_action(e)).collect()
) -> std::collections::HashSet<&str> {
events.iter().filter_map(is_action).collect()
}

#[test]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"command": "pnpm test:e2e",
"ran_at": 1789752415,
"exit_code": 0,
"commit": "69a075bd28096c7647e2d86f13c9268f9bb76a54",
"branch": "claude/1148-clippy-all-targets"
}
Loading