Delete pub items nothing uses, and the stubs that hid unused code

93 pub items (78 functions and methods, 14 constants, 1 struct) in horizon-client,
horizon-world, horizon-core, horizon-friends and horizon-server-files had
no caller anywhere in the repository: not in the crate, the other crates,
the examples, the tests or the binaries. rustc can't flag them because
horizon-client and the others are libraries, where a pub item counts as
used. The imports and the private helpers only they used go with them
(title.rs date_string, goals.rs flag_index).

Also drops the #[allow(dead_code)]/#[allow(unused)] items that only hid
dead code: chat_debug_fill, merchant_title and Goals::locked_by had no
caller, and four stubs (_keep, _unused, _rule_kind, const _) existed only
to keep an import used. LightTables::from_parts is used by its tests, so
it is #[cfg(test)] instead of allowed.

Protocol id tables and entity data serializer ids stay: they mirror
vanilla's registries in full. The launcher's three unused items are left
for a launcher PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-23 12:08:35 +02:00
parent 62a6b3a620
commit 173a55e608
81 changed files with 8 additions and 688 deletions
@@ -812,14 +812,6 @@ pub fn java_parse_int(s: &str) -> Option<i32> {
}
s.parse().ok()
}
/// Long.parseLong.
pub fn java_parse_long(s: &str) -> Option<i64> {
let digits = s.strip_prefix(['-', '+']).unwrap_or(s);
if digits.is_empty() || !digits.chars().all(|c| c.is_ascii_digit()) {
return None;
}
s.parse().ok()
}
/// Double.parseDouble over the characters StringReader reads as a number.
pub fn java_parse_double(s: &str) -> Option<f64> {
let t = s.trim_matches(|c: char| c <= ' ');
@@ -1,7 +1,7 @@
//! ComponentSerialization.CODEC and Style.Serializer.MAP_CODEC decoding of
//! SNBT text components, with the data-fixer-upper error messages
//! (ComponentArgument, StyleArgument and component-valued item data).
use super::codec::{get, no_key, not_list, not_map, snbt};
use super::codec::{get, no_key, not_list, not_map};
use horizon_world::nbt::{Compound, Tag};
/// A DataResult error: its message and whether it carries a partial result.
@@ -362,7 +362,3 @@ pub fn decode_style(t: &Tag) -> Result<(), String> {
_ => Err(not_map(t)),
}
}
#[allow(unused)]
fn _keep(t: &Tag) -> String {
snbt(t)
}
@@ -632,10 +632,6 @@ pub fn parse_predicate(reader: &mut Reader, reg: &Registries) -> CmdResult<ItemI
pub fn suggest_predicate(builder: &mut SuggestionsBuilder, reg: &Registries) {
PREDICATE.with(|g| g.parse_for_suggestions_with(builder, Some(reg)));
}
#[allow(unused)]
fn _unused(t: &Tag) -> String {
snbt(t)
}
#[cfg(test)]
mod tests {
-30
View File
@@ -183,9 +183,6 @@ impl<'a> Reader<'a> {
pub fn read_int(&mut self) -> CmdResult<i32> {
self.number("int")
}
pub fn read_long(&mut self) -> CmdResult<i64> {
self.number("long")
}
pub fn read_double(&mut self) -> CmdResult<f64> {
self.number("double")
}
@@ -222,21 +219,6 @@ impl<'a> Reader<'a> {
}
Err(CommandError::tr_at("parsing.quote.expected.end", &[], self))
}
pub fn read_quoted_string(&mut self) -> CmdResult<String> {
if !self.can_read() {
return Ok(String::new());
}
let next = self.peek();
if next != '"' && next != '\'' {
return Err(CommandError::tr_at(
"parsing.quote.expected.start",
&[],
self,
));
}
self.skip();
self.read_string_until(next)
}
pub fn read_string(&mut self) -> CmdResult<String> {
if !self.can_read() {
return Ok(String::new());
@@ -539,18 +521,6 @@ impl<'a> SuggestionsBuilder<'a> {
}
}
}
/// The same with a tooltip per candidate.
pub fn suggest_matching_tooltip<'b>(
&mut self,
candidates: impl IntoIterator<Item = (&'b str, String)>,
) {
let lower = self.remaining_lower();
for (c, tip) in candidates {
if args::matches_sub_str(&lower, &c.to_lowercase()) {
self.suggest_tooltip(c, tip);
}
}
}
}
/// String.compareToIgnoreCase.
pub fn compare_ignore_case(a: &str, b: &str) -> std::cmp::Ordering {
+1 -5
View File
@@ -1,8 +1,6 @@
//! SnbtGrammar and TagParser: vanilla's packrat SNBT grammar, with its
//! error messages and completion suggestions, producing NBT tags.
use super::packrat::{
Grammar, Reason, Rule, State, Sugg, Term, Value, alt, ch, chs, look, opt, seq,
};
use super::packrat::{Grammar, Reason, State, Sugg, Term, Value, alt, ch, chs, look, opt, seq};
use super::{CmdResult, CommandError, Reader, SuggestionsBuilder};
use horizon_world::nbt::{Compound, JavaString, Tag};
use std::rc::Rc;
@@ -981,5 +979,3 @@ pub fn rule_in<V: super::packrat::Value>(
}
}
}
#[allow(unused)]
fn _rule_kind(_: Rule<SV>) {}
+1 -7
View File
@@ -3,7 +3,7 @@
//! mode keywords are read back from the parsed literals.
use super::{
Dispatcher,
args::{ArgType, GameMode, Resource, integer},
args::{ArgType, Resource, integer},
};
use crate::gamerules::{RULES, Value};
@@ -509,10 +509,6 @@ fn clone_mode(d: &mut Dispatcher, node: usize) {
d.executes(l, "clone");
}
}
/// Game mode names for selector `gamemode=` and the argument.
pub fn game_modes() -> [&'static str; 4] {
GameMode::ALL.map(GameMode::name)
}
/// The shared vanilla tree.
/// Reorder node children as vanilla registers them (Brigadier keeps
/// children in registration order; smart usage lists them that way).
@@ -559,5 +555,3 @@ pub fn release_dispatcher() -> &'static Dispatcher {
static TREE: std::sync::OnceLock<Dispatcher> = std::sync::OnceLock::new();
TREE.get_or_init(|| build_with(false))
}
#[allow(unused)]
const _: (u8, u8) = (ALL, GAMEMASTERS);