aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-03-31 16:42:11 -0700
committerFuwn <[email protected]>2023-03-31 16:42:11 -0700
commit0a568ba1d65130b1f046f95975c9c28588847b95 (patch)
tree64bc6402c0ce829f39f6e87b0deb9f9c620fd6bf /src/modules
parentdeps(windmark): bump 0.2.3 -> 0.2.4 (diff)
downloadlocus-0a568ba1d65130b1f046f95975c9c28588847b95.tar.xz
locus-0a568ba1d65130b1f046f95975c9c28588847b95.zip
refactor(src): use response macros
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/random.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/modules/random.rs b/src/modules/random.rs
index 885782c..889db73 100644
--- a/src/modules/random.rs
+++ b/src/modules/random.rs
@@ -23,15 +23,13 @@ pub fn module(router: &mut windmark::Router) {
router,
"/random",
"Get redirected to a random route",
- Box::new(|_| {
- windmark::Response::temporary_redirect(
- (*crate::route::ROUTES.lock().unwrap())
- .iter()
- .collect::<Vec<_>>()
- .choose(&mut rand::thread_rng())
- .unwrap()
- .0,
- )
- }),
+ windmark::temporary_redirect!(
+ (*crate::route::ROUTES.lock().unwrap())
+ .iter()
+ .collect::<Vec<_>>()
+ .choose(&mut rand::thread_rng())
+ .unwrap()
+ .0
+ ),
);
}