about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPjotr Prins <pjotr.public01@thebird.nl>2026-10-04 06:32:06 +0000
committerPjotr <wrk@bosa.lan>2026-10-04 06:32:06 +0000
commit0c8bad1cdb969cfec807cdd026313ffa848f4720 (patch)
tree808fdfce9f77bd28e9bcb796053a0ced40f09f9b
parent190c20497b015189f1ddd2ecdaf0d6e340c9141f (diff)
downloadgenenetwork4-0c8bad1cdb969cfec807cdd026313ffa848f4720.tar.gz
Format with cargo fmt, matching 924bcf3's project-wide pass.
* src/db.rs, src/routes/groups.rs, tests/dataset_by_name.rs,
tests/group_by_name.rs, tests/group_trait_info.rs: Run cargo fmt. No
behavior change -- this code was written before the project adopted
cargo fmt formatting in 924bcf3 and landed unformatted during the
rebase that merged the two histories.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XDDpXvZBQat9uSgDeEMJ8d
-rw-r--r--src/db.rs91
-rw-r--r--src/routes/groups.rs1
-rw-r--r--tests/dataset_by_name.rs6
-rw-r--r--tests/group_by_name.rs6
-rw-r--r--tests/group_trait_info.rs10
5 files changed, 86 insertions, 28 deletions
diff --git a/src/db.rs b/src/db.rs
index 223bcde..393a861 100644
--- a/src/db.rs
+++ b/src/db.rs
@@ -282,7 +282,10 @@ pub struct TraitValue {
 /// is), so group_id is required to pick the right trait, the same way
 /// GeneNetwork2's trait_sample_data combines trait_name with a group
 /// or dataset to resolve a Publish trait.
-pub fn get_group_trait_values(group_id: u16, trait_id: u32) -> Result<Vec<TraitValue>, mysql::Error> {
+pub fn get_group_trait_values(
+    group_id: u16,
+    trait_id: u32,
+) -> Result<Vec<TraitValue>, mysql::Error> {
     let pool = pool()?;
     let mut conn = pool.get_conn()?;
     conn.exec_map(
@@ -342,7 +345,10 @@ pub struct TraitInfo {
 /// Fetch one published trait's metadata (see TraitInfo) within a
 /// group. Like get_group_trait_values, PublishXRef.Id alone isn't
 /// unique across groups, so group_id is required.
-pub fn get_group_trait_info(group_id: u16, trait_id: u32) -> Result<Option<TraitInfo>, mysql::Error> {
+pub fn get_group_trait_info(
+    group_id: u16,
+    trait_id: u32,
+) -> Result<Option<TraitInfo>, mysql::Error> {
     let pool = pool()?;
     let mut conn = pool.get_conn()?;
     conn.exec_first(
@@ -404,7 +410,18 @@ pub fn get_group_datasets(group_id: u16) -> Result<Vec<Dataset>, mysql::Error> {
          WHERE ProbeFreeze.InbredSetId = :group_id \
          ORDER BY ProbeSetFreeze.Name",
         mysql::params! { "group_id" => group_id },
-        |(id, probe_freeze_id, name, name2, full_name, short_name, create_time, public, confidentiality, data_scale)| {
+        |(
+            id,
+            probe_freeze_id,
+            name,
+            name2,
+            full_name,
+            short_name,
+            create_time,
+            public,
+            confidentiality,
+            data_scale,
+        )| {
             Dataset {
                 id,
                 probe_freeze_id,
@@ -435,10 +452,21 @@ pub fn get_dataset_by_name(name: &str) -> Result<Option<Dataset>, mysql::Error>
                 OR ShortName = :name OR CAST(Id AS CHAR) = :name",
         mysql::params! { "name" => name },
     )
-    .map(|row: Option<(u16, u16, String, Option<String>, String, String, String, u8, u8, String)>| {
-        row.map(
-            |(id, probe_freeze_id, name, name2, full_name, short_name, create_time, public, confidentiality, data_scale)| {
-                Dataset {
+    .map(
+        |row: Option<(
+            u16,
+            u16,
+            String,
+            Option<String>,
+            String,
+            String,
+            String,
+            u8,
+            u8,
+            String,
+        )>| {
+            row.map(
+                |(
                     id,
                     probe_freeze_id,
                     name,
@@ -449,10 +477,23 @@ pub fn get_dataset_by_name(name: &str) -> Result<Option<Dataset>, mysql::Error>
                     public,
                     confidentiality,
                     data_scale,
-                }
-            },
-        )
-    })
+                )| {
+                    Dataset {
+                        id,
+                        probe_freeze_id,
+                        name,
+                        name2,
+                        full_name,
+                        short_name,
+                        create_time,
+                        public,
+                        confidentiality,
+                        data_scale,
+                    }
+                },
+            )
+        },
+    )
 }
 
 /// One expression (ProbeSet) trait's metadata: its ProbeSetXRef
@@ -498,9 +539,33 @@ pub fn get_dataset_probeset_info(
         mysql::params! { "dataset_id" => dataset_id, "probeset_name" => probeset_name },
     )
     .map(
-        |row: Option<(u32, String, Option<String>, Option<String>, Option<String>, Option<f64>, Option<f64>, Option<String>, Option<f64>, Option<f64>, Option<f64>)>| {
+        |row: Option<(
+            u32,
+            String,
+            Option<String>,
+            Option<String>,
+            Option<String>,
+            Option<f64>,
+            Option<f64>,
+            Option<String>,
+            Option<f64>,
+            Option<f64>,
+            Option<f64>,
+        )>| {
             row.map(
-                |(probeset_id, name, symbol, description, chr, mb, mean, locus, lrs, p_value, additive)| {
+                |(
+                    probeset_id,
+                    name,
+                    symbol,
+                    description,
+                    chr,
+                    mb,
+                    mean,
+                    locus,
+                    lrs,
+                    p_value,
+                    additive,
+                )| {
                     ProbeSetInfo {
                         probeset_id,
                         name,
diff --git a/src/routes/groups.rs b/src/routes/groups.rs
index 18a6f66..e4d512e 100644
--- a/src/routes/groups.rs
+++ b/src/routes/groups.rs
@@ -362,4 +362,3 @@ pub async fn group_datasets(
         .with_next("/groups")
     })
 }
-
diff --git a/tests/dataset_by_name.rs b/tests/dataset_by_name.rs
index 48208e6..84a670e 100644
--- a/tests/dataset_by_name.rs
+++ b/tests/dataset_by_name.rs
@@ -17,11 +17,7 @@ async fn dataset_by_name_returns_dataset_row() {
         return;
     }
 
-    let response = common::get(
-        "GET /datasets/Br_U_0803_M",
-        "/datasets/Br_U_0803_M",
-    )
-    .await;
+    let response = common::get("GET /datasets/Br_U_0803_M", "/datasets/Br_U_0803_M").await;
 
     assert_eq!(response.status(), StatusCode::OK);
 
diff --git a/tests/group_by_name.rs b/tests/group_by_name.rs
index bd2bb0f..576fedd 100644
--- a/tests/group_by_name.rs
+++ b/tests/group_by_name.rs
@@ -59,11 +59,7 @@ async fn group_by_name_unknown_group_returns_404() {
         return;
     }
 
-    let response = common::get(
-        "GET /groups/not-a-real-group",
-        "/groups/not-a-real-group",
-    )
-    .await;
+    let response = common::get("GET /groups/not-a-real-group", "/groups/not-a-real-group").await;
 
     assert_eq!(response.status(), StatusCode::NOT_FOUND);
     let request_id = response
diff --git a/tests/group_trait_info.rs b/tests/group_trait_info.rs
index 49a3bdd..3d9a792 100644
--- a/tests/group_trait_info.rs
+++ b/tests/group_trait_info.rs
@@ -26,10 +26,12 @@ async fn group_trait_info_bxd_returns_phenotype_and_publication() {
 
     assert_eq!(info["id"], 10001);
     assert_eq!(info["units"], "mg");
-    assert!(info["post_publication_description"]
-        .as_str()
-        .unwrap()
-        .contains("Cerebellum weight"));
+    assert!(
+        info["post_publication_description"]
+            .as_str()
+            .unwrap()
+            .contains("Cerebellum weight")
+    );
     assert_eq!(info["pubmed_id"], 11438585);
     assert_eq!(info["authors"], "Airey DC, Lu L, Williams RW");
     assert_eq!(info["year"], "2001");