about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlexander_Kabui <alexanderkabui@proton.me>2026-10-14 22:01:57 +0300
committerAlexander_Kabui <alexanderkabui@proton.me>2026-10-14 22:01:57 +0300
commit2604f063f9c3210599cbd55c77e7ee39e712504b (patch)
tree390a5aca29643b2401c886c86da167945aa20e9d /src
parentdfa576b0f821dc8a0beba7acebeed81dc831b17a (diff)
downloadgenenetwork4-2604f063f9c3210599cbd55c77e7ee39e712504b.tar.gz
rustfmt: apply rustfmt across the tree
Pure formatting sweep (import ordering, line wrapping); the tree
had accumulated rustfmt drift. Separated from any semantic change
so it stays reviewable and revertable on its own.
Diffstat (limited to 'src')
-rw-r--r--src/auth.rs32
-rw-r--r--src/config.rs9
-rw-r--r--src/db.rs15
-rw-r--r--src/lib.rs4
-rw-r--r--src/routes/accessions.rs8
-rw-r--r--src/routes/datasets.rs267
-rw-r--r--src/routes/dev.rs26
-rw-r--r--src/routes/groups.rs63
-rw-r--r--src/routes/publications.rs2
-rw-r--r--src/routes/search.rs9
-rw-r--r--src/routes/species.rs2
-rw-r--r--src/routes/traits.rs12
12 files changed, 254 insertions, 195 deletions
diff --git a/src/auth.rs b/src/auth.rs
index d1a86c6..2743a75 100644
--- a/src/auth.rs
+++ b/src/auth.rs
@@ -21,9 +21,9 @@
 //!   same resource don't each cost a round trip to gn-auth.
 
 use axum::extract::FromRequestParts;
-use axum::http::request::Parts;
 use axum::http::StatusCode;
-use jsonwebtoken::{decode, Algorithm, DecodingKey, Validation};
+use axum::http::request::Parts;
+use jsonwebtoken::{Algorithm, DecodingKey, Validation, decode};
 use serde::{Deserialize, Serialize};
 use std::collections::HashMap;
 use std::sync::{Mutex, OnceLock};
@@ -273,10 +273,19 @@ pub fn check(
         return Ok(Some(Authorized(())));
     }
     let authorised = match trait_name {
-        Some(trait_name) => {
-            authorise_trait(auth_server_url, token, dataset_name, trait_name, VIEW_RESOURCE_PRIVILEGE)?
-        }
-        None => authorise_dataset(auth_server_url, token, dataset_name, VIEW_RESOURCE_PRIVILEGE)?,
+        Some(trait_name) => authorise_trait(
+            auth_server_url,
+            token,
+            dataset_name,
+            trait_name,
+            VIEW_RESOURCE_PRIVILEGE,
+        )?,
+        None => authorise_dataset(
+            auth_server_url,
+            token,
+            dataset_name,
+            VIEW_RESOURCE_PRIVILEGE,
+        )?,
     };
     Ok(authorised.then_some(Authorized(())))
 }
@@ -294,7 +303,16 @@ pub fn is_authorised(
     confidentiality: u8,
     create_time: &str,
 ) -> Result<bool, String> {
-    Ok(check(auth_server_url, token, dataset_name, trait_name, public, confidentiality, create_time)?.is_some())
+    Ok(check(
+        auth_server_url,
+        token,
+        dataset_name,
+        trait_name,
+        public,
+        confidentiality,
+        create_time,
+    )?
+    .is_some())
 }
 
 #[derive(Serialize)]
diff --git a/src/config.rs b/src/config.rs
index 5ae2913..7d8893c 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -120,10 +120,7 @@ impl Config {
             "GN_AUTH_DEV_USERNAME".to_string(),
             "test@development.user".to_string(),
         );
-        values.insert(
-            "GN_AUTH_DEV_PASSWORD".to_string(),
-            "testpasswd".to_string(),
-        );
+        values.insert("GN_AUTH_DEV_PASSWORD".to_string(), "testpasswd".to_string());
         values.insert(
             "GN3_URL".to_string(),
             "http://127.0.0.1:5003/api/".to_string(),
@@ -357,7 +354,9 @@ mod tests {
         for on in ["true", "TRUE", "True", "1", "yes", "ON", " on "] {
             assert!(parse_switch(on), "{on:?}");
         }
-        for off in ["false", "False", "0", "no", "off", "", "flase", "maybe", "2", "tru"] {
+        for off in [
+            "false", "False", "0", "no", "off", "", "flase", "maybe", "2", "tru",
+        ] {
             assert!(!parse_switch(off), "{off:?}");
         }
     }
diff --git a/src/db.rs b/src/db.rs
index 2675875..ecc19fd 100644
--- a/src/db.rs
+++ b/src/db.rs
@@ -1,7 +1,7 @@
 //! Read-only access to the GeneNetwork MariaDB database (db_webqtl).
 
 use mysql::prelude::{FromRow, Queryable};
-use mysql::{params, Opts, OptsBuilder, Pool, PoolOpts};
+use mysql::{Opts, OptsBuilder, Pool, PoolOpts, params};
 use serde::Serialize;
 use std::sync::{Mutex, OnceLock};
 
@@ -480,10 +480,7 @@ 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>, DbError> {
+pub fn get_group_trait_values(group_id: u16, trait_id: u32) -> Result<Vec<TraitValue>, DbError> {
     let pool = pool()?;
     let mut conn = pool.get_conn()?;
     conn.exec_map(
@@ -554,8 +551,7 @@ const GN_SHOW_TRAIT_URL: &str = "https://genenetwork.org/show_trait";
 
 /// A published trait's short name; shared by every query that reports
 /// or filters on it.
-const ABBREVIATION_SQL: &str =
-    "COALESCE(NULLIF(Phenotype.Post_publication_abbreviation, ''), Phenotype.Pre_publication_abbreviation)";
+const ABBREVIATION_SQL: &str = "COALESCE(NULLIF(Phenotype.Post_publication_abbreviation, ''), Phenotype.Pre_publication_abbreviation)";
 
 /// The SELECT behind every TraitInfo row; callers add the WHERE
 /// `filter` and the ORDER BY. PublishFreeze is joined on InbredSetId,
@@ -591,10 +587,7 @@ fn trait_info_sql(filter: &str, order_by: &str) -> String {
 /// 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>, DbError> {
+pub fn get_group_trait_info(group_id: u16, trait_id: u32) -> Result<Option<TraitInfo>, DbError> {
     let pool = pool()?;
     let mut conn = pool.get_conn()?;
     conn.exec_first(
diff --git a/src/lib.rs b/src/lib.rs
index 9297d87..5731147 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -11,13 +11,13 @@ pub mod config;
 pub mod db;
 pub mod embedded;
 mod error;
-pub mod indexer;
 mod gemma;
+pub mod indexer;
 pub mod response;
 mod routes;
+mod rqtl;
 pub mod search;
 mod streaming;
-mod rqtl;
 
 use error::ApiError;
 use response::{Ctx, Envelope};
diff --git a/src/routes/accessions.rs b/src/routes/accessions.rs
index 66801e0..3ca7f7e 100644
--- a/src/routes/accessions.rs
+++ b/src/routes/accessions.rs
@@ -65,11 +65,15 @@ pub async fn accession(
             let category = found.category.clone();
             let mut envelope = ctx.envelope(found);
             if let Some(group) = &group {
-                envelope = envelope.with_next(&format!("/groups/{group}"), "The group the dataset belongs to");
+                envelope = envelope.with_next(
+                    &format!("/groups/{group}"),
+                    "The group the dataset belongs to",
+                );
             }
             match (category.as_deref(), &group) {
                 (Some("probeset"), _) => {
-                    envelope = envelope.with_next(&format!("/datasets/{name}"), "The expression dataset");
+                    envelope =
+                        envelope.with_next(&format!("/datasets/{name}"), "The expression dataset");
                 }
                 (Some("publish"), Some(group)) => {
                     envelope = envelope.with_next(
diff --git a/src/routes/datasets.rs b/src/routes/datasets.rs
index 8c903ce..34a2b09 100644
--- a/src/routes/datasets.rs
+++ b/src/routes/datasets.rs
@@ -2,7 +2,7 @@
 //! the ProbeSetFreeze/ProbeSetXRef/ProbeSet tables.
 
 use axum::Json;
-use axum::extract::{Path};
+use axum::extract::Path;
 use axum::http::StatusCode;
 
 use gnauth_macros::gnauth;
@@ -145,12 +145,10 @@ pub async fn dataset_probesets(
     })
     .and_then(|lookup| match lookup {
         DatasetProbesetsLookup::Found(_authorized, probesets) => Ok(Json(
-            ctx.envelope(probesets)
-                .with_note(db::LOD_NOTE)
-                .with_next(
-                    &format!("/datasets/{}", path_segment(&not_found_name)),
-                    "The dataset these probesets belong to",
-                ),
+            ctx.envelope(probesets).with_note(db::LOD_NOTE).with_next(
+                &format!("/datasets/{}", path_segment(&not_found_name)),
+                "The dataset these probesets belong to",
+            ),
         )),
         DatasetProbesetsLookup::Forbidden => Err(ApiError::new(
             StatusCode::FORBIDDEN,
@@ -252,71 +250,74 @@ pub async fn dataset_probeset_info(
         get_dataset_probeset_info_result(&dataset, &probeset, &auth_server_url, &token)
     })
     .await
-        .map_err(|e| {
-            ApiError::new(
-                StatusCode::INTERNAL_SERVER_ERROR,
-                "internal_error",
-                "Internal error",
-                e.to_string(),
-                "dataset_probeset_info",
-            )
-            .with_request_id(rid.clone())
-        })?
-        .map_err(|e| match e {
-            DatasetAuthError::Db(e) => {
-                ApiError::from_db(e, "dataset_probeset_info").with_request_id(rid.clone())
-            }
-            DatasetAuthError::Auth(e) => ApiError::new(
-                StatusCode::BAD_GATEWAY,
-                "auth_server_error",
-                "Could not check authorization",
-                e,
-                "dataset_probeset_info",
-            )
-            .with_request_id(rid.clone()),
-        })
-        .and_then(|lookup| match lookup {
-            DatasetProbesetLookup::Found(_authorized, info) => {
-                let dataset = path_segment(&not_found_dataset);
-                let probeset = path_segment(&not_found_probeset);
-                Ok(Json(
-                    ctx.envelope(info)
-                        .with_note(db::LOD_NOTE)
-                        .with_next(
-                            &format!("/datasets/{dataset}/probesets/{probeset}/values"),
-                            "The probeset's value in each strain",
-                        )
-                        .with_next(&format!("/datasets/{dataset}"), "The dataset this probeset belongs to"),
-                ))
-            }
-            DatasetProbesetLookup::Forbidden => Err(ApiError::new(
-                StatusCode::FORBIDDEN,
-                "forbidden",
-                "Not authorized",
-                format!(
-                    "'{not_found_probeset}' in dataset '{not_found_dataset}' is not public, \
+    .map_err(|e| {
+        ApiError::new(
+            StatusCode::INTERNAL_SERVER_ERROR,
+            "internal_error",
+            "Internal error",
+            e.to_string(),
+            "dataset_probeset_info",
+        )
+        .with_request_id(rid.clone())
+    })?
+    .map_err(|e| match e {
+        DatasetAuthError::Db(e) => {
+            ApiError::from_db(e, "dataset_probeset_info").with_request_id(rid.clone())
+        }
+        DatasetAuthError::Auth(e) => ApiError::new(
+            StatusCode::BAD_GATEWAY,
+            "auth_server_error",
+            "Could not check authorization",
+            e,
+            "dataset_probeset_info",
+        )
+        .with_request_id(rid.clone()),
+    })
+    .and_then(|lookup| match lookup {
+        DatasetProbesetLookup::Found(_authorized, info) => {
+            let dataset = path_segment(&not_found_dataset);
+            let probeset = path_segment(&not_found_probeset);
+            Ok(Json(
+                ctx.envelope(info)
+                    .with_note(db::LOD_NOTE)
+                    .with_next(
+                        &format!("/datasets/{dataset}/probesets/{probeset}/values"),
+                        "The probeset's value in each strain",
+                    )
+                    .with_next(
+                        &format!("/datasets/{dataset}"),
+                        "The dataset this probeset belongs to",
+                    ),
+            ))
+        }
+        DatasetProbesetLookup::Forbidden => Err(ApiError::new(
+            StatusCode::FORBIDDEN,
+            "forbidden",
+            "Not authorized",
+            format!(
+                "'{not_found_probeset}' in dataset '{not_found_dataset}' is not public, \
                      and you are not authorized to view it."
-                ),
-                "dataset_probeset_info",
-            )
-            .with_request_id(rid.clone())),
-            DatasetProbesetLookup::DatasetNotFound => Err(ApiError::new(
-                StatusCode::NOT_FOUND,
-                "dataset_not_found",
-                "Dataset not found",
-                format!("No dataset matching '{not_found_dataset}'."),
-                "dataset_probeset_info",
-            )
-            .with_request_id(rid.clone())),
-            DatasetProbesetLookup::ProbesetNotFound => Err(ApiError::new(
-                StatusCode::NOT_FOUND,
-                "probeset_not_found",
-                "Probeset not found",
-                format!("No probeset '{not_found_probeset}' in dataset '{not_found_dataset}'."),
-                "dataset_probeset_info",
-            )
-            .with_request_id(rid)),
-        })
+            ),
+            "dataset_probeset_info",
+        )
+        .with_request_id(rid.clone())),
+        DatasetProbesetLookup::DatasetNotFound => Err(ApiError::new(
+            StatusCode::NOT_FOUND,
+            "dataset_not_found",
+            "Dataset not found",
+            format!("No dataset matching '{not_found_dataset}'."),
+            "dataset_probeset_info",
+        )
+        .with_request_id(rid.clone())),
+        DatasetProbesetLookup::ProbesetNotFound => Err(ApiError::new(
+            StatusCode::NOT_FOUND,
+            "probeset_not_found",
+            "Probeset not found",
+            format!("No probeset '{not_found_probeset}' in dataset '{not_found_dataset}'."),
+            "dataset_probeset_info",
+        )
+        .with_request_id(rid)),
+    })
 }
 
 fn get_dataset_probeset_values_result(
@@ -374,67 +375,67 @@ pub async fn dataset_probeset_values(
         get_dataset_probeset_values_result(&dataset, &probeset, &auth_server_url, &token)
     })
     .await
-        .map_err(|e| {
-            ApiError::new(
-                StatusCode::INTERNAL_SERVER_ERROR,
-                "internal_error",
-                "Internal error",
-                e.to_string(),
-                "dataset_probeset_values",
-            )
-            .with_request_id(rid.clone())
-        })?
-        .map_err(|e| match e {
-            DatasetAuthError::Db(e) => {
-                ApiError::from_db(e, "dataset_probeset_values").with_request_id(rid.clone())
-            }
-            DatasetAuthError::Auth(e) => ApiError::new(
-                StatusCode::BAD_GATEWAY,
-                "auth_server_error",
-                "Could not check authorization",
-                e,
-                "dataset_probeset_values",
-            )
-            .with_request_id(rid.clone()),
-        })
-        .and_then(|lookup| match lookup {
-            DatasetProbesetLookup::Found(authorized, values) => {
-                let _: Authorized = authorized;
-                Ok(Json(ctx.envelope(values).with_next(
-                    &format!(
-                        "/datasets/{}/probesets/{}",
-                        path_segment(&not_found_dataset),
-                        path_segment(&not_found_probeset)
-                    ),
-                    "The probeset's metadata",
-                )))
-            }
-            DatasetProbesetLookup::Forbidden => Err(ApiError::new(
-                StatusCode::FORBIDDEN,
-                "forbidden",
-                "Not authorized",
-                format!(
-                    "'{not_found_probeset}' in dataset '{not_found_dataset}' is not public, \
-                     and you are not authorized to view it."
+    .map_err(|e| {
+        ApiError::new(
+            StatusCode::INTERNAL_SERVER_ERROR,
+            "internal_error",
+            "Internal error",
+            e.to_string(),
+            "dataset_probeset_values",
+        )
+        .with_request_id(rid.clone())
+    })?
+    .map_err(|e| match e {
+        DatasetAuthError::Db(e) => {
+            ApiError::from_db(e, "dataset_probeset_values").with_request_id(rid.clone())
+        }
+        DatasetAuthError::Auth(e) => ApiError::new(
+            StatusCode::BAD_GATEWAY,
+            "auth_server_error",
+            "Could not check authorization",
+            e,
+            "dataset_probeset_values",
+        )
+        .with_request_id(rid.clone()),
+    })
+    .and_then(|lookup| match lookup {
+        DatasetProbesetLookup::Found(authorized, values) => {
+            let _: Authorized = authorized;
+            Ok(Json(ctx.envelope(values).with_next(
+                &format!(
+                    "/datasets/{}/probesets/{}",
+                    path_segment(&not_found_dataset),
+                    path_segment(&not_found_probeset)
                 ),
-                "dataset_probeset_values",
-            )
-            .with_request_id(rid.clone())),
-            DatasetProbesetLookup::DatasetNotFound => Err(ApiError::new(
-                StatusCode::NOT_FOUND,
-                "dataset_not_found",
-                "Dataset not found",
-                format!("No dataset matching '{not_found_dataset}'."),
-                "dataset_probeset_values",
-            )
-            .with_request_id(rid.clone())),
-            DatasetProbesetLookup::ProbesetNotFound => Err(ApiError::new(
-                StatusCode::NOT_FOUND,
-                "probeset_not_found",
-                "Probeset not found",
-                format!("No probeset '{not_found_probeset}' in dataset '{not_found_dataset}'."),
-                "dataset_probeset_values",
-            )
-            .with_request_id(rid)),
-        })
+                "The probeset's metadata",
+            )))
+        }
+        DatasetProbesetLookup::Forbidden => Err(ApiError::new(
+            StatusCode::FORBIDDEN,
+            "forbidden",
+            "Not authorized",
+            format!(
+                "'{not_found_probeset}' in dataset '{not_found_dataset}' is not public, \
+                     and you are not authorized to view it."
+            ),
+            "dataset_probeset_values",
+        )
+        .with_request_id(rid.clone())),
+        DatasetProbesetLookup::DatasetNotFound => Err(ApiError::new(
+            StatusCode::NOT_FOUND,
+            "dataset_not_found",
+            "Dataset not found",
+            format!("No dataset matching '{not_found_dataset}'."),
+            "dataset_probeset_values",
+        )
+        .with_request_id(rid.clone())),
+        DatasetProbesetLookup::ProbesetNotFound => Err(ApiError::new(
+            StatusCode::NOT_FOUND,
+            "probeset_not_found",
+            "Probeset not found",
+            format!("No probeset '{not_found_probeset}' in dataset '{not_found_dataset}'."),
+            "dataset_probeset_values",
+        )
+        .with_request_id(rid)),
+    })
 }
diff --git a/src/routes/dev.rs b/src/routes/dev.rs
index 7b1aa49..58f50c2 100644
--- a/src/routes/dev.rs
+++ b/src/routes/dev.rs
@@ -53,7 +53,9 @@ struct TokenResponse {
 fn is_local(peer: &SocketAddr) -> bool {
     match peer.ip() {
         IpAddr::V4(ip) => ip.is_loopback(),
-        IpAddr::V6(ip) => ip.is_loopback() || ip.to_ipv4_mapped().is_some_and(|v4| v4.is_loopback()),
+        IpAddr::V6(ip) => {
+            ip.is_loopback() || ip.to_ipv4_mapped().is_some_and(|v4| v4.is_loopback())
+        }
     }
 }
 
@@ -82,7 +84,9 @@ pub async fn get_test_token(
 ) -> Result<Json<Envelope<TestToken>>, ApiError> {
     let rid = ctx.request_info();
     // Fail closed: a request with no known peer address is refused too.
-    let local = peer.as_ref().is_some_and(|Extension(ConnectInfo(addr))| is_local(addr));
+    let local = peer
+        .as_ref()
+        .is_some_and(|Extension(ConnectInfo(addr))| is_local(addr));
     if !local || via_proxy(&headers) {
         return Err(ApiError::new(
             StatusCode::FORBIDDEN,
@@ -158,10 +162,24 @@ mod tests {
 
     #[test]
     fn only_loopback_peers_are_local() {
-        for yes in ["127.0.0.1:1", "127.0.1.2:80", "127.255.255.254:9", "[::1]:3000", "[::ffff:127.0.0.1]:5"] {
+        for yes in [
+            "127.0.0.1:1",
+            "127.0.1.2:80",
+            "127.255.255.254:9",
+            "[::1]:3000",
+            "[::ffff:127.0.0.1]:5",
+        ] {
             assert!(local(yes), "{yes}");
         }
-        for no in ["10.0.0.5:1", "192.168.1.20:80", "128.0.0.1:1", "0.0.0.0:1", "[::2]:1", "[::ffff:10.0.0.1]:1", "[fe80::1]:1"] {
+        for no in [
+            "10.0.0.5:1",
+            "192.168.1.20:80",
+            "128.0.0.1:1",
+            "0.0.0.0:1",
+            "[::2]:1",
+            "[::ffff:10.0.0.1]:1",
+            "[fe80::1]:1",
+        ] {
             assert!(!local(no), "{no}");
         }
     }
diff --git a/src/routes/groups.rs b/src/routes/groups.rs
index b43fb31..48778f6 100644
--- a/src/routes/groups.rs
+++ b/src/routes/groups.rs
@@ -60,22 +60,28 @@ pub async fn groups(
         })?
         .map(|groups| {
             let groups: Vec<db::Group> = groups
-                    .into_iter()
-                    .filter(|g| params.family.as_ref().is_none_or(|f| contains_ci(&g.family, f)))
-                    .filter(|g| {
-                        params
-                            .species
-                            .as_ref()
-                            .is_none_or(|s| g.species.as_deref().is_some_and(|n| n.eq_ignore_ascii_case(s)))
+                .into_iter()
+                .filter(|g| {
+                    params
+                        .family
+                        .as_ref()
+                        .is_none_or(|f| contains_ci(&g.family, f))
+                })
+                .filter(|g| {
+                    params.species.as_ref().is_none_or(|s| {
+                        g.species
+                            .as_deref()
+                            .is_some_and(|n| n.eq_ignore_ascii_case(s))
                     })
-                    .filter(|g| {
-                        params.q.as_ref().is_none_or(|q| {
-                            contains_ci(&Some(g.name.clone()), q)
-                                || contains_ci(&g.display_name, q)
-                                || contains_ci(&g.full_name, q)
-                        })
+                })
+                .filter(|g| {
+                    params.q.as_ref().is_none_or(|q| {
+                        contains_ci(&Some(g.name.clone()), q)
+                            || contains_ci(&g.display_name, q)
+                            || contains_ci(&g.full_name, q)
                     })
-                    .collect();
+                })
+                .collect();
             Json(ctx.envelope(groups).with_next(
                 "/species",
                 "The species the groups belong to (filter groups with ?species=<name>)",
@@ -117,7 +123,10 @@ pub async fn group_by_name(
             let name = path_segment(&detail.name);
             Json(
                 ctx.envelope(detail)
-                    .with_next(&format!("/groups/{name}/strains"), "The group's strains/samples")
+                    .with_next(
+                        &format!("/groups/{name}/strains"),
+                        "The group's strains/samples",
+                    )
                     .with_next(
                         &format!("/groups/{name}/case-attributes"),
                         "Case-attribute names and per-strain values",
@@ -191,7 +200,10 @@ pub async fn group_strains(
         let group = path_segment(&not_found_name);
         Json(
             ctx.envelope(strains)
-                .with_next(&format!("/groups/{group}"), "The group these strains belong to")
+                .with_next(
+                    &format!("/groups/{group}"),
+                    "The group these strains belong to",
+                )
                 .with_next(
                     &format!("/groups/{group}/case-attributes"),
                     "Case-attribute names and per-strain values",
@@ -453,7 +465,10 @@ pub async fn group_trait_info(
                     &format!("/groups/{group}/traits/{trait_id}/values"),
                     "The trait's value in each strain",
                 )
-                .with_next(&format!("/groups/{group}"), "The group this trait belongs to");
+                .with_next(
+                    &format!("/groups/{group}"),
+                    "The group this trait belongs to",
+                );
             if let Some(pubmed_id) = pubmed_id {
                 envelope = envelope.with_next(
                     &format!("/publications/{pubmed_id}/traits"),
@@ -553,7 +568,12 @@ pub async fn group_traits(
     let not_found_name = group.clone();
     let auth_server_url = Config::load().auth_server_url.clone();
     tokio::task::spawn_blocking(move || {
-        get_group_traits_result(&group, params.abbreviation.as_deref(), &auth_server_url, &token)
+        get_group_traits_result(
+            &group,
+            params.abbreviation.as_deref(),
+            &auth_server_url,
+            &token,
+        )
     })
     .await
     .map_err(|e| {
@@ -581,9 +601,10 @@ pub async fn group_traits(
         GroupTraitsLookup::Found(traits) => {
             let group = path_segment(&not_found_name);
             Ok(Json(
-                ctx.envelope(traits)
-                    .with_note(db::LOD_NOTE)
-                    .with_next(&format!("/groups/{group}"), "The group these traits belong to"),
+                ctx.envelope(traits).with_note(db::LOD_NOTE).with_next(
+                    &format!("/groups/{group}"),
+                    "The group these traits belong to",
+                ),
             ))
         }
         GroupTraitsLookup::Forbidden => Err(ApiError::new(
diff --git a/src/routes/publications.rs b/src/routes/publications.rs
index 635486a..fe2f553 100644
--- a/src/routes/publications.rs
+++ b/src/routes/publications.rs
@@ -1,7 +1,7 @@
 //! Publications domain endpoint: which traits a paper reports.
 
 use axum::Json;
-use axum::extract::{Path};
+use axum::extract::Path;
 use axum::http::StatusCode;
 use std::collections::HashMap;
 
diff --git a/src/routes/search.rs b/src/routes/search.rs
index 3fdfc36..f1ae7cf 100644
--- a/src/routes/search.rs
+++ b/src/routes/search.rs
@@ -256,7 +256,9 @@ pub async fn search(
     }
     if more {
         let mut query = url::form_urlencoded::Serializer::new(String::new());
-        query.append_pair("q", q).append_pair("limit", &limit.to_string());
+        query
+            .append_pair("q", q)
+            .append_pair("limit", &limit.to_string());
         if let Some(search_type) = params.r#type.as_deref() {
             query.append_pair("type", search_type);
         }
@@ -267,7 +269,10 @@ pub async fn search(
             query.append_pair("order", order);
         }
         query.append_pair("page", &(page + 1).to_string());
-        envelope = envelope.with_next(&format!("/search?{}", query.finish()), "The next page of hits");
+        envelope = envelope.with_next(
+            &format!("/search?{}", query.finish()),
+            "The next page of hits",
+        );
     }
     if let Some((dataset, name)) = top {
         envelope = envelope.with_next(
diff --git a/src/routes/species.rs b/src/routes/species.rs
index 4214f02..6c7474b 100644
--- a/src/routes/species.rs
+++ b/src/routes/species.rs
@@ -1,7 +1,7 @@
 //! Species domain endpoints: read-only access to the Species table.
 
 use axum::Json;
-use axum::extract::{Path};
+use axum::extract::Path;
 use axum::http::StatusCode;
 
 use gnauth_macros::gnauth;
diff --git a/src/routes/traits.rs b/src/routes/traits.rs
index 1ceb752..b4013c3 100644
--- a/src/routes/traits.rs
+++ b/src/routes/traits.rs
@@ -12,9 +12,9 @@
 //! this -- this is an additional, category-spanning way to reach the
 //! same underlying data, not a replacement.
 
-use axum::extract::{Path};
-use axum::http::StatusCode;
 use axum::Json;
+use axum::extract::Path;
+use axum::http::StatusCode;
 use serde::Serialize;
 
 use gnauth_macros::gnauth;
@@ -310,10 +310,10 @@ pub async fn trait_info(
                 TraitInfoResponse::Publish(info) => info.pubmed_id,
                 TraitInfoResponse::Probeset(_) => None,
             };
-            let mut envelope = ctx
-                .envelope(*info)
-                .with_note(db::LOD_NOTE)
-                .with_next(&format!("{base}/values"), "The trait's value in each strain");
+            let mut envelope = ctx.envelope(*info).with_note(db::LOD_NOTE).with_next(
+                &format!("{base}/values"),
+                "The trait's value in each strain",
+            );
             if let Some(pubmed_id) = pubmed_id {
                 envelope = envelope.with_next(
                     &format!("/publications/{pubmed_id}/traits"),