Skip to content

Commit 50b13d7

Browse files
committed
style: cargo fmt
1 parent a0dd6f7 commit 50b13d7

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

kq-core/src/db.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,9 @@ pub fn set_last_indexed_commit(conn: &Connection, commit: &str) -> Result<()> {
194194

195195
/// Retrieve the last indexed git commit hash, if any.
196196
pub fn get_last_indexed_commit(conn: &Connection) -> Result<Option<String>> {
197-
let result =
198-
conn.query_row("SELECT last_indexed_commit FROM schema_version WHERE version = 1", [], |row| {
199-
row.get::<_, Option<String>>(0)
200-
});
197+
let result = conn.query_row("SELECT last_indexed_commit FROM schema_version WHERE version = 1", [], |row| {
198+
row.get::<_, Option<String>>(0)
199+
});
201200
match result {
202201
Ok(commit) => Ok(commit),
203202
Err(rusqlite::Error::QueryReturnedNoRows) => Ok(None),

kq-core/src/typespec.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,7 @@ fn extract_doc_marker(line: &str) -> Option<String> {
172172
let line = line.strip_prefix("//")?.trim();
173173
let after = line.strip_prefix("@doc ")?;
174174
let id: String = after.chars().take_while(|c| !c.is_whitespace()).collect();
175-
if id.is_empty() {
176-
None
177-
} else {
178-
Some(id)
179-
}
175+
if id.is_empty() { None } else { Some(id) }
180176
}
181177

182178
fn collect_imports(ts_dir: &Path) -> Result<Vec<String>> {
@@ -362,7 +358,10 @@ mod tests {
362358

363359
#[test]
364360
fn test_parse_models_marker_before_model() {
365-
let models = parse_models("// @doc TZ-100\nmodel X {\n id: string;\n}\n// @doc TZ-200\nmodel Y {\n id: string;\n}", "types.tsp");
361+
let models = parse_models(
362+
"// @doc TZ-100\nmodel X {\n id: string;\n}\n// @doc TZ-200\nmodel Y {\n id: string;\n}",
363+
"types.tsp",
364+
);
366365
assert_eq!(models.len(), 2);
367366
assert_eq!(models[0].name, "X");
368367
assert_eq!(models[0].doc_refs, vec!["TZ-100".to_string()]);
@@ -372,7 +371,8 @@ mod tests {
372371

373372
#[test]
374373
fn test_parse_models_marker_inside_body() {
375-
let models = parse_models("model A {\n // @doc TZ-001\n id: string;\n}\nmodel B {\n id: string;\n}", "types.tsp");
374+
let models =
375+
parse_models("model A {\n // @doc TZ-001\n id: string;\n}\nmodel B {\n id: string;\n}", "types.tsp");
376376
assert_eq!(models.len(), 2);
377377
assert_eq!(models[0].name, "A");
378378
assert_eq!(models[0].doc_refs, vec!["TZ-001".to_string()]);

0 commit comments

Comments
 (0)