Deny unreachable_pub lint in libloot

This commit is contained in:
Oliver Hamlet
2025-07-31 22:10:44 +01:00
parent 139047f230
commit 67b50ee8d9
20 changed files with 109 additions and 103 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ use crate::{GameType, game::GameCache, plugin::has_ascii_extension};
const BSA_FILE_EXTENSION: &str = "bsa";
pub fn find_associated_archives(
pub(crate) fn find_associated_archives(
game_type: GameType,
game_cache: &GameCache,
plugin_path: &Path,
@@ -205,7 +205,7 @@ mod tests {
}
impl Fixture {
pub fn new(game_type: GameType) -> Self {
fn new(game_type: GameType) -> Self {
let tmp_dir = tempdir().unwrap();
let mut cache = GameCache::default();
+3 -3
View File
@@ -6,10 +6,10 @@ mod parse;
use std::collections::{BTreeMap, BTreeSet};
pub use find::find_associated_archives;
pub use parse::assets_in_archives;
pub(crate) use find::find_associated_archives;
pub(crate) use parse::assets_in_archives;
pub fn do_assets_overlap(
pub(crate) fn do_assets_overlap(
assets: &BTreeMap<u64, BTreeSet<u64>>,
other_assets: &BTreeMap<u64, BTreeSet<u64>>,
) -> bool {
+1 -1
View File
@@ -14,7 +14,7 @@ use crate::{
use super::{ba2, bsa};
pub fn assets_in_archives(archive_paths: &[PathBuf]) -> BTreeMap<u64, BTreeSet<u64>> {
pub(crate) fn assets_in_archives(archive_paths: &[PathBuf]) -> BTreeMap<u64, BTreeSet<u64>> {
let mut archive_assets: BTreeMap<u64, BTreeSet<u64>> = BTreeMap::new();
for archive_path in archive_paths {
+3 -3
View File
@@ -4,7 +4,7 @@ use loot_condition_interpreter::Expression;
use crate::metadata::{File, PluginCleaningData, PluginMetadata};
pub fn evaluate_all_conditions(
pub(crate) fn evaluate_all_conditions(
mut metadata: PluginMetadata,
state: &loot_condition_interpreter::State,
) -> Result<Option<PluginMetadata>, loot_condition_interpreter::Error> {
@@ -57,7 +57,7 @@ pub fn evaluate_all_conditions(
}
}
pub fn evaluate_condition(
pub(crate) fn evaluate_condition(
condition: &str,
state: &loot_condition_interpreter::State,
) -> Result<bool, loot_condition_interpreter::Error> {
@@ -75,7 +75,7 @@ fn evaluate_condition_option(
}
}
pub fn filter_map_on_condition<T: Clone>(
pub(crate) fn filter_map_on_condition<T: Clone>(
item: &T,
condition: Option<&str>,
state: &loot_condition_interpreter::State,
+2 -2
View File
@@ -773,7 +773,7 @@ pub(crate) struct GameCache {
}
impl GameCache {
pub fn set_archive_paths(&mut self, archive_paths: Vec<PathBuf>) {
pub(crate) fn set_archive_paths(&mut self, archive_paths: Vec<PathBuf>) {
self.archive_paths.clear();
self.archive_paths.extend(archive_paths);
}
@@ -801,7 +801,7 @@ impl GameCache {
self.plugins.get(&Filename::new(plugin_name.to_owned()))
}
pub fn archives_iter(&self) -> impl Iterator<Item = &PathBuf> {
pub(crate) fn archives_iter(&self) -> impl Iterator<Item = &PathBuf> {
self.archive_paths.iter()
}
}
-1
View File
@@ -1,6 +1,5 @@
// Allow some lints that are denied at the workspace level.
#![allow(
unreachable_pub,
clippy::doc_markdown,
clippy::exhaustive_enums,
clippy::filetype_is_file,
+1 -1
View File
@@ -147,7 +147,7 @@ macro_rules! trace {
($($arg:tt)+) => { $crate::logging::log!(crate::LogLevel::Trace, $($arg)+) };
}
pub fn is_log_enabled(level: LogLevel) -> bool {
pub(crate) fn is_log_enabled(level: LogLevel) -> bool {
if log::log_enabled!(level.into()) {
return true;
}
+16 -13
View File
@@ -22,7 +22,7 @@ use super::{
};
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct MetadataDocument {
pub(crate) struct MetadataDocument {
bash_tags: Vec<String>,
groups: Vec<Group>,
messages: Vec<Message>,
@@ -31,7 +31,7 @@ pub struct MetadataDocument {
}
impl MetadataDocument {
pub fn load(&mut self, file_path: &Path) -> Result<(), LoadMetadataError> {
pub(crate) fn load(&mut self, file_path: &Path) -> Result<(), LoadMetadataError> {
if !file_path.exists() {
return Err(LoadMetadataError::new(
file_path.into(),
@@ -55,7 +55,7 @@ impl MetadataDocument {
Ok(())
}
pub fn load_with_prelude(
pub(crate) fn load_with_prelude(
&mut self,
masterlist_path: &Path,
prelude_path: &Path,
@@ -199,7 +199,7 @@ impl MetadataDocument {
Ok(())
}
pub fn save(&self, file_path: &Path) -> Result<(), WriteMetadataError> {
pub(crate) fn save(&self, file_path: &Path) -> Result<(), WriteMetadataError> {
logging::trace!("Saving metadata list to: \"{}\"", escape_ascii(file_path));
let mut emitter = YamlEmitter::new();
@@ -251,23 +251,26 @@ impl MetadataDocument {
Ok(())
}
pub fn bash_tags(&self) -> &[String] {
pub(crate) fn bash_tags(&self) -> &[String] {
&self.bash_tags
}
pub fn groups(&self) -> &[Group] {
pub(crate) fn groups(&self) -> &[Group] {
&self.groups
}
pub fn messages(&self) -> &[Message] {
pub(crate) fn messages(&self) -> &[Message] {
&self.messages
}
pub fn plugins_iter(&self) -> impl Iterator<Item = &PluginMetadata> {
pub(crate) fn plugins_iter(&self) -> impl Iterator<Item = &PluginMetadata> {
self.plugins.values().chain(self.regex_plugins.iter())
}
pub fn find_plugin(&self, plugin_name: &str) -> Result<Option<PluginMetadata>, RegexError> {
pub(crate) fn find_plugin(
&self,
plugin_name: &str,
) -> Result<Option<PluginMetadata>, RegexError> {
let mut metadata = match self.plugins.get(&Filename::new(plugin_name.to_owned())) {
Some(m) => m.clone(),
None => PluginMetadata::new(plugin_name)?,
@@ -287,7 +290,7 @@ impl MetadataDocument {
}
}
pub fn set_groups(&mut self, groups: Vec<Group>) {
pub(crate) fn set_groups(&mut self, groups: Vec<Group>) {
// Ensure that the default group is present.
let default_group_exists = groups.iter().any(|g| g.name() == Group::DEFAULT_NAME);
@@ -300,7 +303,7 @@ impl MetadataDocument {
}
}
pub fn set_plugin_metadata(&mut self, plugin_metadata: PluginMetadata) {
pub(crate) fn set_plugin_metadata(&mut self, plugin_metadata: PluginMetadata) {
if plugin_metadata.is_regex_plugin() {
self.regex_plugins.push(plugin_metadata);
} else {
@@ -311,11 +314,11 @@ impl MetadataDocument {
}
}
pub fn remove_plugin_metadata(&mut self, plugin_name: &str) {
pub(crate) fn remove_plugin_metadata(&mut self, plugin_name: &str) {
self.plugins.remove(&Filename::new(plugin_name.to_owned()));
}
pub fn clear(&mut self) {
pub(crate) fn clear(&mut self) {
self.bash_tags.clear();
self.groups.clear();
self.messages.clear();
+14 -14
View File
@@ -1,4 +1,4 @@
pub trait EmitYaml {
pub(in crate::metadata) trait EmitYaml {
fn is_scalar(&self) -> bool {
false
}
@@ -7,7 +7,7 @@ pub trait EmitYaml {
}
#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct YamlEmitter {
pub(in crate::metadata) struct YamlEmitter {
buffer: String,
scope: Vec<YamlBlock>,
style: YamlStyle,
@@ -34,7 +34,7 @@ impl YamlEmitter {
const INDENT_UNIT: &str = " ";
const ARRAY_ELEMENT_PREFIX: &str = "- ";
pub fn new() -> Self {
pub(in crate::metadata) fn new() -> Self {
Self {
buffer: String::new(),
scope: vec![],
@@ -42,11 +42,11 @@ impl YamlEmitter {
}
}
pub fn into_string(self) -> String {
pub(in crate::metadata) fn into_string(self) -> String {
self.buffer
}
pub fn unquoted_str(&mut self, value: &str) {
pub(in crate::metadata) fn unquoted_str(&mut self, value: &str) {
if self.style == YamlStyle::Block {
self.write_prefix();
}
@@ -60,7 +60,7 @@ impl YamlEmitter {
}
}
pub fn single_quoted_str(&mut self, value: &str) {
pub(in crate::metadata) fn single_quoted_str(&mut self, value: &str) {
if self.style == YamlStyle::Block {
self.write_prefix();
}
@@ -72,7 +72,7 @@ impl YamlEmitter {
}
}
pub fn u32(&mut self, value: u32) {
pub(in crate::metadata) fn u32(&mut self, value: u32) {
if self.style == YamlStyle::Block {
self.write_prefix();
}
@@ -80,7 +80,7 @@ impl YamlEmitter {
self.write(&value.to_string());
}
pub fn begin_map(&mut self) {
pub(in crate::metadata) fn begin_map(&mut self) {
if self.scope.last() == Some(&YamlBlock::Array) {
self.end_line();
self.write_indent();
@@ -88,7 +88,7 @@ impl YamlEmitter {
}
}
pub fn end_map(&mut self) {
pub(in crate::metadata) fn end_map(&mut self) {
if self.scope.last() == Some(&YamlBlock::Map) {
self.scope.pop();
}
@@ -97,7 +97,7 @@ impl YamlEmitter {
/// This assumes that the given key is valid to be written as an unquoted
/// string, and expects a string literal so that it's obvious that a given
/// value is valid.
pub fn map_key(&mut self, key: &'static str) {
pub(in crate::metadata) fn map_key(&mut self, key: &'static str) {
match self.scope.last() {
Some(&YamlBlock::Map) => {
self.end_line();
@@ -109,7 +109,7 @@ impl YamlEmitter {
self.write(&format!("{key}:"));
}
pub fn begin_array(&mut self) {
pub(in crate::metadata) fn begin_array(&mut self) {
if self.style == YamlStyle::Flow {
if self.scope.last() == Some(&YamlBlock::Map) {
self.write(" ");
@@ -120,7 +120,7 @@ impl YamlEmitter {
self.scope.push(YamlBlock::Array);
}
pub fn end_array(&mut self) {
pub(in crate::metadata) fn end_array(&mut self) {
if self.scope.last() == Some(&YamlBlock::Array) {
self.scope.pop();
}
@@ -130,11 +130,11 @@ impl YamlEmitter {
}
}
pub fn set_flow_style(&mut self) {
pub(in crate::metadata) fn set_flow_style(&mut self) {
self.style = YamlStyle::Flow;
}
pub fn set_block_style(&mut self) {
pub(in crate::metadata) fn set_block_style(&mut self) {
self.style = YamlStyle::Block;
}
+3 -1
View File
@@ -2,7 +2,9 @@ use saphyr::{MarkedYaml, YamlData};
use crate::metadata::error::YamlMergeKeyError;
pub fn process_merge_keys(mut yaml: MarkedYaml) -> Result<MarkedYaml, YamlMergeKeyError> {
pub(in crate::metadata) fn process_merge_keys(
mut yaml: MarkedYaml,
) -> Result<MarkedYaml, YamlMergeKeyError> {
match yaml.data {
YamlData::Sequence(a) => {
yaml.data = merge_array_elements(a).map(YamlData::Sequence)?;
+3 -3
View File
@@ -2,9 +2,9 @@ mod emit;
mod merge;
mod parse;
pub use emit::{EmitYaml, YamlEmitter};
pub use merge::process_merge_keys;
pub use parse::{
pub(in crate::metadata) use emit::{EmitYaml, YamlEmitter};
pub(in crate::metadata) use merge::process_merge_keys;
pub(in crate::metadata) use parse::{
TryFromYaml, YamlObjectType, as_mapping, get_required_string_value, get_slice_value,
get_string_value, get_strings_vec_value, get_u32_value, get_value, parse_condition,
to_unmarked_yaml,
+11 -11
View File
@@ -6,7 +6,7 @@ use saphyr::{AnnotatedMapping, MarkedYaml, Marker, Scalar, Yaml, YamlData};
use super::super::error::{ExpectedType, MetadataParsingErrorReason, ParseMetadataError};
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum YamlObjectType {
pub(in crate::metadata) enum YamlObjectType {
File,
Group,
Location,
@@ -36,7 +36,7 @@ impl std::fmt::Display for YamlObjectType {
}
}
pub fn to_unmarked_yaml<'a>(yaml: &MarkedYaml<'a>) -> Yaml<'a> {
pub(in crate::metadata) fn to_unmarked_yaml<'a>(yaml: &MarkedYaml<'a>) -> Yaml<'a> {
match &yaml.data {
YamlData::Value(Scalar::FloatingPoint(v)) => Yaml::Value(Scalar::FloatingPoint(*v)),
YamlData::Value(Scalar::Integer(v)) => Yaml::Value(Scalar::Integer(*v)),
@@ -56,14 +56,14 @@ pub fn to_unmarked_yaml<'a>(yaml: &MarkedYaml<'a>) -> Yaml<'a> {
}
}
pub fn get_value<'a, 'b>(
pub(in crate::metadata) fn get_value<'a, 'b>(
mapping: &'a AnnotatedMapping<'b, MarkedYaml<'b>>,
key: &'static str,
) -> Option<&'a MarkedYaml<'b>> {
mapping.get(&MarkedYaml::value_from_str(key))
}
pub fn get_string_value<'a>(
pub(in crate::metadata) fn get_string_value<'a>(
mapping: &'a AnnotatedMapping<MarkedYaml>,
key: &'static str,
yaml_type: YamlObjectType,
@@ -82,7 +82,7 @@ pub fn get_string_value<'a>(
}
}
pub fn get_required_string_value<'a>(
pub(in crate::metadata) fn get_required_string_value<'a>(
marker: Marker,
mapping: &'a AnnotatedMapping<MarkedYaml>,
key: &'static str,
@@ -94,7 +94,7 @@ pub fn get_required_string_value<'a>(
}
}
pub fn get_strings_vec_value<'a>(
pub(in crate::metadata) fn get_strings_vec_value<'a>(
mapping: &'a AnnotatedMapping<MarkedYaml>,
key: &'static str,
yaml_type: YamlObjectType,
@@ -124,7 +124,7 @@ pub fn get_strings_vec_value<'a>(
}
}
pub fn as_mapping<'a, 'b>(
pub(in crate::metadata) fn as_mapping<'a, 'b>(
value: &'a MarkedYaml<'b>,
yaml_type: YamlObjectType,
) -> Result<&'a AnnotatedMapping<'a, MarkedYaml<'b>>, ParseMetadataError> {
@@ -138,7 +138,7 @@ pub fn as_mapping<'a, 'b>(
}
}
pub fn get_u32_value(
pub(in crate::metadata) fn get_u32_value(
mapping: &AnnotatedMapping<MarkedYaml>,
key: &'static str,
yaml_type: YamlObjectType,
@@ -159,7 +159,7 @@ pub fn get_u32_value(
}
}
pub fn get_slice_value<'a>(
pub(in crate::metadata) fn get_slice_value<'a>(
mapping: &'a saphyr::AnnotatedMapping<MarkedYaml>,
key: &'static str,
yaml_type: YamlObjectType,
@@ -179,7 +179,7 @@ pub fn get_slice_value<'a>(
}
}
pub fn parse_condition(
pub(in crate::metadata) fn parse_condition(
mapping: &saphyr::AnnotatedMapping<MarkedYaml>,
key: &'static str,
yaml_type: YamlObjectType,
@@ -198,6 +198,6 @@ pub fn parse_condition(
/// This is effectively TryFrom<&MarkedYaml>, but implementing it doesn't make
/// MarkedYaml part of the crate's public API.
pub trait TryFromYaml: Sized {
pub(in crate::metadata) trait TryFromYaml: Sized {
fn try_from_yaml(value: &MarkedYaml) -> Result<Self, ParseMetadataError>;
}
+1 -1
View File
@@ -1,4 +1,4 @@
pub mod error;
pub(crate) mod error;
use std::{
collections::{BTreeMap, BTreeSet},
+1 -1
View File
@@ -26,7 +26,7 @@ impl Display for UndefinedGroupError {
impl std::error::Error for UndefinedGroupError {}
#[derive(Clone, Default, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct CyclicInteractionError {
pub(crate) struct CyclicInteractionError {
cycle: Vec<Vertex>,
}
+7 -5
View File
@@ -21,9 +21,9 @@ use super::{
search::{DfsVisitor, depth_first_search},
};
pub type GroupsGraph = Graph<Box<str>, EdgeType>;
pub(super) type GroupsGraph = Graph<Box<str>, EdgeType>;
pub fn build_groups_graph(
pub(crate) fn build_groups_graph(
masterlist_groups: &[Group],
userlist_groups: &[Group],
) -> Result<GroupsGraph, BuildGroupsGraphError> {
@@ -115,7 +115,7 @@ fn sorted_clone(strings: &[String]) -> Vec<&str> {
strings
}
pub fn find_path(
pub(crate) fn find_path(
graph: &GroupsGraph,
from_group_name: &str,
to_group_name: &str,
@@ -211,7 +211,7 @@ fn find_node_by_weight(
/// Sort the group vertices so that root vertices come first, in order of
/// decreasing path length, but otherwise preserving the existing
/// (lexicographical) ordering.
pub fn sorted_group_nodes(graph: &GroupsGraph) -> Vec<NodeIndex> {
pub(super) fn sorted_group_nodes(graph: &GroupsGraph) -> Vec<NodeIndex> {
let mut nodes: Vec<(NodeIndex, bool, usize)> = graph
.node_indices()
.map(|n| {
@@ -274,7 +274,9 @@ impl<'a> DfsVisitor<'a> for GroupsPathLengthVisitor {
}
}
pub fn get_default_group_node(graph: &GroupsGraph) -> Result<NodeIndex, UndefinedGroupError> {
pub(super) fn get_default_group_node(
graph: &GroupsGraph,
) -> Result<NodeIndex, UndefinedGroupError> {
graph
.node_indices()
.find(|n| graph[*n].as_ref() == Group::DEFAULT_NAME)
+9 -9
View File
@@ -1,9 +1,9 @@
pub mod error;
pub mod groups;
pub mod plugins;
pub(crate) mod error;
pub(crate) mod groups;
pub(crate) mod plugins;
mod search;
mod validate;
pub mod vertex;
pub(crate) mod vertex;
#[cfg(test)]
mod test {
@@ -11,7 +11,7 @@ mod test {
use crate::error::PluginDataError;
#[derive(Default)]
pub struct TestPlugin {
pub(super) struct TestPlugin {
name: String,
masters: Vec<String>,
pub(super) is_master: bool,
@@ -23,22 +23,22 @@ mod test {
}
impl TestPlugin {
pub fn new(name: &str) -> Self {
pub(super) fn new(name: &str) -> Self {
Self {
name: name.to_owned(),
..Default::default()
}
}
pub fn add_master(&mut self, plugin_name: &str) {
pub(super) fn add_master(&mut self, plugin_name: &str) {
self.masters.push(plugin_name.to_owned());
}
pub fn add_overlapping_records(&mut self, plugin_name: &str) {
pub(super) fn add_overlapping_records(&mut self, plugin_name: &str) {
self.overlapping_record_plugins.push(plugin_name.to_owned());
}
pub fn add_overlapping_assets(&mut self, plugin_name: &str) {
pub(super) fn add_overlapping_assets(&mut self, plugin_name: &str) {
self.overlapping_asset_plugins.push(plugin_name.to_owned());
}
}
+4 -4
View File
@@ -25,7 +25,7 @@ use super::{
};
#[derive(Debug)]
pub struct PluginSortingData<'a, T: SortingPlugin> {
pub(crate) struct PluginSortingData<'a, T: SortingPlugin> {
plugin: &'a T,
pub(super) is_master: bool,
override_record_count: usize,
@@ -41,7 +41,7 @@ pub struct PluginSortingData<'a, T: SortingPlugin> {
}
impl<'a, T: SortingPlugin> PluginSortingData<'a, T> {
pub fn new(
pub(crate) fn new(
plugin: &'a T,
masterlist_metadata: Option<&PluginMetadata>,
user_metadata: Option<&PluginMetadata>,
@@ -100,7 +100,7 @@ impl<'a, T: SortingPlugin> PluginSortingData<'a, T> {
}
}
pub trait SortingPlugin {
pub(crate) trait SortingPlugin {
fn name(&self) -> &str;
fn is_master(&self) -> bool;
fn is_blueprint_plugin(&self) -> bool;
@@ -779,7 +779,7 @@ impl<'a, T: SortingPlugin> std::ops::Index<NodeIndex> for PluginsGraph<'a, T> {
}
}
pub fn sort_plugins<T: SortingPlugin>(
pub(crate) fn sort_plugins<T: SortingPlugin>(
mut plugins_sorting_data: Vec<PluginSortingData<T>>,
groups_graph: &GroupsGraph,
early_loading_plugins: &[String],
+6 -6
View File
@@ -9,7 +9,7 @@ use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet};
use crate::{EdgeType, Vertex, logging};
pub trait DfsVisitor<'a> {
pub(super) trait DfsVisitor<'a> {
fn visit_tree_edge(&mut self, edge_ref: EdgeReference<'a, EdgeType>);
fn visit_forward_or_cross_edge(&mut self, edge_ref: EdgeReference<'a, EdgeType>);
@@ -21,7 +21,7 @@ pub trait DfsVisitor<'a> {
fn finish_node(&mut self, node_index: NodeIndex);
}
pub trait BidirBfsVisitor {
pub(super) trait BidirBfsVisitor {
fn visit_forward_bfs_edge(&mut self, source: NodeIndex, target: NodeIndex);
fn visit_reverse_bfs_edge(&mut self, source: NodeIndex, target: NodeIndex);
@@ -29,7 +29,7 @@ pub trait BidirBfsVisitor {
fn visit_intersection_node(&mut self, node: NodeIndex);
}
pub fn bidirectional_bfs<N, E>(
pub(super) fn bidirectional_bfs<N, E>(
graph: &Graph<N, E>,
from_index: NodeIndex,
to_index: NodeIndex,
@@ -78,7 +78,7 @@ pub fn bidirectional_bfs<N, E>(
}
// Petgraph has APIs for performing depth-first searches, but they don't give any information about the current edge, only its source and target nodes, which is a problem if the same pair of nodes can have multiple edges between them with different weights. As such, implement it myself.
pub fn find_cycle<N>(
pub(super) fn find_cycle<N>(
graph: &Graph<N, EdgeType>,
node_mapper: impl FnMut(&N) -> String,
) -> Option<Vec<Vertex>> {
@@ -99,14 +99,14 @@ pub fn find_cycle<N>(
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[non_exhaustive]
pub enum Colour {
pub(super) enum Colour {
#[default]
White,
Grey,
Black,
}
pub fn depth_first_search<'a, N>(
pub(super) fn depth_first_search<'a, N>(
graph: &'a Graph<N, EdgeType>,
colour_map: &mut HashMap<NodeIndex, Colour>,
start_node_index: NodeIndex,
+2 -2
View File
@@ -12,7 +12,7 @@ use super::{
plugins::{PluginSortingData, SortingPlugin},
};
pub fn validate_plugin_groups<T: SortingPlugin>(
pub(super) fn validate_plugin_groups<T: SortingPlugin>(
plugins_sorting_data: &[PluginSortingData<'_, T>],
groups_graph: &GroupsGraph,
) -> Result<(), UndefinedGroupError> {
@@ -30,7 +30,7 @@ pub fn validate_plugin_groups<T: SortingPlugin>(
Ok(())
}
pub fn validate_specific_and_hardcoded_edges<T: SortingPlugin>(
pub(super) fn validate_specific_and_hardcoded_edges<T: SortingPlugin>(
masters: &[PluginSortingData<'_, T>],
blueprint_masters: &[PluginSortingData<'_, T>],
non_masters: &[PluginSortingData<'_, T>],
+20 -20
View File
@@ -8,25 +8,25 @@ use crate::GameType;
use parameterized_test::test_parameter;
use tempfile::TempDir;
pub const BLANK_ESM: &str = "Blank.esm";
pub const BLANK_DIFFERENT_ESM: &str = "Blank - Different.esm";
pub const BLANK_MASTER_DEPENDENT_ESM: &str = "Blank - Master Dependent.esm";
pub(crate) const BLANK_ESM: &str = "Blank.esm";
pub(crate) const BLANK_DIFFERENT_ESM: &str = "Blank - Different.esm";
pub(crate) const BLANK_MASTER_DEPENDENT_ESM: &str = "Blank - Master Dependent.esm";
const BLANK_DIFFERENT_MASTER_DEPENDENT_ESM: &str = "Blank - Different Master Dependent.esm";
pub const BLANK_ESP: &str = "Blank.esp";
pub const BLANK_DIFFERENT_ESP: &str = "Blank - Different.esp";
pub const BLANK_MASTER_DEPENDENT_ESP: &str = "Blank - Master Dependent.esp";
pub(crate) const BLANK_ESP: &str = "Blank.esp";
pub(crate) const BLANK_DIFFERENT_ESP: &str = "Blank - Different.esp";
pub(crate) const BLANK_MASTER_DEPENDENT_ESP: &str = "Blank - Master Dependent.esp";
const BLANK_DIFFERENT_MASTER_DEPENDENT_ESP: &str = "Blank - Different Master Dependent.esp";
const BLANK_PLUGIN_DEPENDENT_ESP: &str = "Blank - Plugin Dependent.esp";
const BLANK_DIFFERENT_PLUGIN_DEPENDENT_ESP: &str = "Blank - Different Plugin Dependent.esp";
pub const BLANK_FULL_ESM: &str = "Blank.full.esm";
pub const BLANK_MEDIUM_ESM: &str = "Blank.medium.esm";
pub const BLANK_OVERRIDE_ESP: &str = "Blank - Override.esp";
pub const BLANK_ESL: &str = "Blank.esl";
pub const NON_PLUGIN_FILE: &str = "NotAPlugin.esm";
pub const NON_ASCII_ESM: &str = "non\u{00C1}scii.esm";
pub(crate) const BLANK_FULL_ESM: &str = "Blank.full.esm";
pub(crate) const BLANK_MEDIUM_ESM: &str = "Blank.medium.esm";
pub(crate) const BLANK_OVERRIDE_ESP: &str = "Blank - Override.esp";
pub(crate) const BLANK_ESL: &str = "Blank.esl";
pub(crate) const NON_PLUGIN_FILE: &str = "NotAPlugin.esm";
pub(crate) const NON_ASCII_ESM: &str = "non\u{00C1}scii.esm";
pub fn source_plugins_path(game_type: GameType) -> PathBuf {
pub(crate) fn source_plugins_path(game_type: GameType) -> PathBuf {
match game_type {
GameType::Morrowind | GameType::OpenMW => {
absolute("./testing-plugins/Morrowind/Data Files")
@@ -55,7 +55,7 @@ fn master_file(game_type: GameType) -> &'static str {
}
}
pub fn copy_file(source_dir: &Path, dest_dir: &Path, filename: &str) {
pub(crate) fn copy_file(source_dir: &Path, dest_dir: &Path, filename: &str) {
copy(source_dir.join(filename), dest_dir.join(filename)).unwrap();
}
@@ -81,7 +81,7 @@ fn is_load_order_timestamp_based(game_type: GameType) -> bool {
)
}
pub fn initial_load_order(game_type: GameType) -> Vec<(&'static str, bool)> {
pub(crate) fn initial_load_order(game_type: GameType) -> Vec<(&'static str, bool)> {
if game_type == GameType::Starfield {
vec![
(master_file(game_type), true),
@@ -176,7 +176,7 @@ fn data_path(game_type: GameType, game_path: &Path) -> PathBuf {
}
}
pub struct Fixture {
pub(crate) struct Fixture {
_temp_dir: TempDir,
pub(crate) game_type: GameType,
pub(crate) game_path: PathBuf,
@@ -184,7 +184,7 @@ pub struct Fixture {
}
impl Fixture {
pub fn new(game_type: GameType) -> Self {
pub(crate) fn new(game_type: GameType) -> Self {
let temp_dir = tempfile::Builder::new()
.prefix("libloot-t\u{00E9}st-")
.tempdir()
@@ -193,7 +193,7 @@ impl Fixture {
Self::with_tempdir(game_type, temp_dir)
}
pub fn in_path(game_type: GameType, in_path: &Path) -> Fixture {
pub(crate) fn in_path(game_type: GameType, in_path: &Path) -> Fixture {
let temp_dir = tempfile::Builder::new()
.prefix("libloot-t\u{00E9}st-")
.tempdir_in(in_path)
@@ -314,13 +314,13 @@ impl Fixture {
}
}
pub fn data_path(&self) -> PathBuf {
pub(crate) fn data_path(&self) -> PathBuf {
data_path(self.game_type, &self.game_path)
}
}
#[test_parameter]
pub const ALL_GAME_TYPES: [GameType; 12] = [
pub(crate) const ALL_GAME_TYPES: [GameType; 12] = [
GameType::Oblivion,
GameType::Skyrim,
GameType::Fallout3,