From ccc8058bd64442e0b482dbb86f0e8610c72462af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtte?= Date: Wed, 13 Mar 2024 13:56:15 +0100 Subject: [PATCH] Ordering of the modules by their name ref #648 --- crates/rune/src/doc/build.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/rune/src/doc/build.rs b/crates/rune/src/doc/build.rs index d06ff423c..f0575bc83 100644 --- a/crates/rune/src/doc/build.rs +++ b/crates/rune/src/doc/build.rs @@ -165,6 +165,18 @@ pub(crate) fn build( tests: Vec::new(), }; + // sort the crates by their name + initial.make_contiguous().sort_by_key(|item| { + if let Build::Module(m) = item { + if let Some(item) = m.item { + if let Some(name) = item.as_crate() { + return name; + } + } + } + "" + }); + let mut queue = initial.into_iter().try_collect::>()?; let mut modules = Vec::new();