Skip to content

Commit 69f5089

Browse files
committed
fix(ci): format rust sources
1 parent 83a26a0 commit 69f5089

5 files changed

Lines changed: 28 additions & 22 deletions

File tree

grapha-swift/src/treesitter.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4270,8 +4270,7 @@ pub fn enrich_localization_metadata_with_tree(
42704270
}
42714271

42724272
if builtin_view_accepts_localized_title(&view_node.name) {
4273-
if let Some(reference) = builtin_view_title_reference(text, &view_node.name, bindings)
4274-
{
4273+
if let Some(reference) = builtin_view_title_reference(text, &view_node.name, bindings) {
42754274
let usage_id = emit_localization_usage_node(
42764275
&mut context,
42774276
&view_node.id,
@@ -6328,7 +6327,13 @@ class GameManager {
63286327
.filter_map(|node| node.metadata.get("l10n.literal").map(|v| v.as_str()))
63296328
.collect();
63306329

6331-
for expected in &["Tournament", "Settings", "Notifications", "Profile", "Account"] {
6330+
for expected in &[
6331+
"Tournament",
6332+
"Settings",
6333+
"Notifications",
6334+
"Profile",
6335+
"Account",
6336+
] {
63326337
assert!(
63336338
literals.contains(expected),
63346339
"expected literal '{}' from built-in SwiftUI view, got: {:?}",

grapha/src/cache.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ impl QueryCache {
138138
if let Some(parent) = self.cache_path.parent() {
139139
fs::create_dir_all(parent)?;
140140
}
141-
let bytes =
142-
bincode::serialize(&entries).context("serialising query cache to bincode")?;
141+
let bytes = bincode::serialize(&entries).context("serialising query cache to bincode")?;
143142
fs::write(&self.cache_path, bytes)
144143
.with_context(|| format!("writing query cache {}", self.cache_path.display()))?;
145144
Ok(())
@@ -264,7 +263,10 @@ mod tests {
264263
fs::write(&db_path, b"db v2").unwrap();
265264

266265
let result = qc.get("key", &db_path);
267-
assert!(result.is_none(), "cache should be invalidated after db write");
266+
assert!(
267+
result.is_none(),
268+
"cache should be invalidated after db write"
269+
);
268270
}
269271

270272
#[test]

grapha/src/localization.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,8 +1523,9 @@ mod tests {
15231523
#[test]
15241524
fn resolve_usage_matches_literal_as_catalog_key() {
15251525
let mut usage = Node {
1526-
id: "Features/Tournament/TournamentView.swift::TournamentView::body::view:Text@5:8:5:30"
1527-
.to_string(),
1526+
id:
1527+
"Features/Tournament/TournamentView.swift::TournamentView::body::view:Text@5:8:5:30"
1528+
.to_string(),
15281529
kind: NodeKind::View,
15291530
name: "Text".to_string(),
15301531
file: PathBuf::from("Features/Tournament/TournamentView.swift"),

grapha/src/main.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,9 @@ fn load_graph(path: &Path) -> anyhow::Result<grapha_core::graph::Graph> {
711711
let db_path = store_dir.join("grapha.db");
712712

713713
let graph_cache = cache::GraphCache::new(&store_dir);
714-
if graph_cache.is_fresh(&db_path) && let Ok(graph) = graph_cache.load() {
714+
if graph_cache.is_fresh(&db_path)
715+
&& let Ok(graph) = graph_cache.load()
716+
{
715717
return Ok(graph);
716718
}
717719

@@ -1319,8 +1321,7 @@ fn handle_l10n_command(
13191321
let query_cache = cache::QueryCache::new(&store_dir);
13201322
let format_key = format!("{format:?}");
13211323
let fields_key = fields.as_deref().unwrap_or("");
1322-
let cache_key =
1323-
query_cache_key(&["l10n", "symbol", &symbol, &format_key, fields_key]);
1324+
let cache_key = query_cache_key(&["l10n", "symbol", &symbol, &format_key, fields_key]);
13241325

13251326
if let Some(cached) = query_cache.get(&cache_key, &db_path) {
13261327
print!("{cached}");

grapha/src/store/sqlite.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -454,10 +454,7 @@ impl SqliteStore {
454454
/// - `metadata_key_prefix`: when set, only deserialize metadata for nodes whose raw
455455
/// metadata contains this prefix; other nodes get an empty map. Also skips loading
456456
/// signature, doc_comment, and snippet columns.
457-
pub fn load_with_edge_filter(
458-
&self,
459-
edge_kinds: Option<&[EdgeKind]>,
460-
) -> anyhow::Result<Graph> {
457+
pub fn load_with_edge_filter(&self, edge_kinds: Option<&[EdgeKind]>) -> anyhow::Result<Graph> {
461458
self.load_filtered(edge_kinds, None)
462459
}
463460

@@ -1825,10 +1822,12 @@ mod tests {
18251822
2,
18261823
"only Contains and TypeRef edges should be loaded"
18271824
);
1828-
assert!(filtered.edges.iter().all(|e| matches!(
1829-
e.kind,
1830-
EdgeKind::Contains | EdgeKind::TypeRef
1831-
)));
1825+
assert!(
1826+
filtered
1827+
.edges
1828+
.iter()
1829+
.all(|e| matches!(e.kind, EdgeKind::Contains | EdgeKind::TypeRef))
1830+
);
18321831
}
18331832

18341833
#[test]
@@ -1883,9 +1882,7 @@ mod tests {
18831882

18841883
store.save(&graph).unwrap();
18851884

1886-
let slim = store
1887-
.load_filtered(None, Some("l10n."))
1888-
.unwrap();
1885+
let slim = store.load_filtered(None, Some("l10n.")).unwrap();
18891886
assert_eq!(slim.nodes.len(), 2, "all nodes should be loaded");
18901887

18911888
let l10n_node = slim.nodes.iter().find(|n| n.id == "a").unwrap();

0 commit comments

Comments
 (0)