mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Enable the doc_markdown Clippy lint in libloot
This commit is contained in:
@@ -0,0 +1 @@
|
||||
doc-valid-idents = ["CommonMark", "FormIDs", "OpenMW", ".."]
|
||||
+1
-1
@@ -207,7 +207,7 @@ impl Database {
|
||||
/// user metadata involved while minimising the amount of masterlist
|
||||
/// metadata involved. It's not the path involving the fewest groups.
|
||||
///
|
||||
/// If there is no path between the two groups, the returned [Vec] will be
|
||||
/// If there is no path between the two groups, the returned `Vec` will be
|
||||
/// empty.
|
||||
pub fn groups_path(
|
||||
&self,
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ use crate::sorting::error::{
|
||||
};
|
||||
use crate::{Vertex, escape_ascii};
|
||||
|
||||
/// Represents an error that occurred while trying to create a [Game][crate::Game].
|
||||
/// Represents an error that occurred while trying to create a [`Game`].
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum GameHandleCreationError {
|
||||
@@ -71,7 +71,7 @@ impl From<loadorder::Error> for LoadOrderError {
|
||||
}
|
||||
}
|
||||
|
||||
/// Indicates that the Database's RwLock wrapper has been poisoned and as such
|
||||
/// Indicates that the Database's `RwLock` wrapper has been poisoned and as such
|
||||
/// the Database may be in an invalid state.
|
||||
#[derive(Clone, Copy, Default, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
||||
pub struct DatabaseLockPoisonError;
|
||||
|
||||
+4
-4
@@ -158,7 +158,7 @@ impl Game {
|
||||
///
|
||||
/// This function will attempt to look up the game's local data path, which
|
||||
/// may fail in some situations (e.g. when running libloot natively on Linux
|
||||
/// for a game other than Morrowind or OpenMW). [Game::with_local_path]
|
||||
/// for a game other than Morrowind or OpenMW). [`Game::with_local_path`]
|
||||
/// can be used to provide the local path instead.
|
||||
pub fn new(game_type: GameType, game_path: &Path) -> Result<Self, GameHandleCreationError> {
|
||||
logging::info!(
|
||||
@@ -415,8 +415,8 @@ impl Game {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Clears the plugins loaded by previous calls to [Game::load_plugins] or
|
||||
/// [Game::load_plugin_headers].
|
||||
/// Clears the plugins loaded by previous calls to [`Game::load_plugins`] or
|
||||
/// [`Game::load_plugin_headers`].
|
||||
pub fn clear_loaded_plugins(&mut self) {
|
||||
self.cache.clear_plugins();
|
||||
}
|
||||
@@ -441,7 +441,7 @@ impl Game {
|
||||
///
|
||||
/// The order in which plugins are listed in `plugin_filenames` is used as
|
||||
/// their current load order. All given plugins must have been already been
|
||||
/// loaded using [Game::load_plugins] or [Game::load_plugin_headers].
|
||||
/// loaded using [`Game::load_plugins`] or [`Game::load_plugin_headers`].
|
||||
pub fn sort_plugins(&self, plugin_names: &[&str]) -> Result<Vec<String>, SortPluginsError> {
|
||||
let plugins = plugin_names
|
||||
.iter()
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Allow some lints that are denied at the workspace level.
|
||||
#![allow(
|
||||
clippy::doc_markdown,
|
||||
clippy::filetype_is_file,
|
||||
clippy::must_use_candidate,
|
||||
clippy::missing_errors_doc,
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::{escape_ascii, metadata::MessageContent};
|
||||
use super::yaml::{YamlObjectType, to_unmarked_yaml};
|
||||
|
||||
/// Represents an error that occurred when validating a collection of
|
||||
/// [MessageContent] objects.
|
||||
/// [`MessageContent`] objects.
|
||||
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
||||
pub struct MultilingualMessageContentsError;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ pub struct File {
|
||||
}
|
||||
|
||||
impl File {
|
||||
/// Construct a [File] with the given name. This can also be a relative path.
|
||||
/// Create a value with the given name. This can also be a relative path.
|
||||
#[must_use]
|
||||
pub fn new(name: String) -> Self {
|
||||
Self {
|
||||
@@ -51,7 +51,7 @@ impl File {
|
||||
|
||||
/// Set the detail message content, which may be appended to any messages
|
||||
/// generated for this file. If multilingual, one language must be
|
||||
/// [MessageContent::DEFAULT_LANGUAGE].
|
||||
/// [`MessageContent::DEFAULT_LANGUAGE`].
|
||||
pub fn with_detail(
|
||||
mut self,
|
||||
detail: Vec<MessageContent>,
|
||||
@@ -103,7 +103,7 @@ impl File {
|
||||
pub struct Filename(Box<str>);
|
||||
|
||||
impl Filename {
|
||||
/// Construct a Filename using the given string.
|
||||
/// Create a value using the given string.
|
||||
#[must_use]
|
||||
pub fn new(s: String) -> Self {
|
||||
Filename(s.into())
|
||||
|
||||
@@ -20,7 +20,7 @@ impl Group {
|
||||
/// The name of the group to which all plugins belong by default.
|
||||
pub const DEFAULT_NAME: &'static str = "default";
|
||||
|
||||
/// Construct a [Group] with the given name.
|
||||
/// Create a value with the given name.
|
||||
#[must_use]
|
||||
pub fn new(name: String) -> Self {
|
||||
Self {
|
||||
@@ -60,7 +60,7 @@ impl Group {
|
||||
}
|
||||
|
||||
impl std::default::Default for Group {
|
||||
/// Construct a Group with the default name and an empty set of groups to
|
||||
/// Create a value with the default name and an empty set of groups to
|
||||
/// load after.
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
|
||||
@@ -13,7 +13,7 @@ pub struct Location {
|
||||
}
|
||||
|
||||
impl Location {
|
||||
/// Construct a [Location] with the given URL.
|
||||
/// Create a value with the given URL.
|
||||
#[must_use]
|
||||
pub fn new(url: String) -> Self {
|
||||
Location {
|
||||
|
||||
+10
-12
@@ -52,8 +52,7 @@ impl MessageContent {
|
||||
/// The code for the default language assumed for message content.
|
||||
pub const DEFAULT_LANGUAGE: &'static str = "en";
|
||||
|
||||
/// Construct a [MessageContent] object with the given text in the default
|
||||
/// language.
|
||||
/// Create a value with the given text in the default language.
|
||||
#[must_use]
|
||||
pub fn new(text: String) -> Self {
|
||||
MessageContent {
|
||||
@@ -81,8 +80,7 @@ impl MessageContent {
|
||||
}
|
||||
|
||||
impl std::default::Default for MessageContent {
|
||||
/// Construct a [MessageContent] object with an empty message string and the
|
||||
/// default language.
|
||||
/// Create a value with an empty message string and the default language.
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
text: Box::default(),
|
||||
@@ -91,8 +89,8 @@ impl std::default::Default for MessageContent {
|
||||
}
|
||||
}
|
||||
|
||||
/// Choose a [MessageContent] object from those given in `content` based on the
|
||||
/// given `language`.
|
||||
/// Choose a `MessageContent` object from those given in `content` based on
|
||||
/// the given `language`.
|
||||
///
|
||||
/// Language strings are expected to have the form
|
||||
/// `[language code]` or `[language code]_[country code]`, where
|
||||
@@ -110,7 +108,7 @@ impl std::default::Default for MessageContent {
|
||||
/// returned.
|
||||
/// * If no matches are found and content in the default language is present,
|
||||
/// that content is returned.
|
||||
/// * Otherwise, an empty [Option] is returned.
|
||||
/// * Otherwise, an empty `Option` is returned.
|
||||
pub fn select_message_content<'a>(
|
||||
content: &'a [MessageContent],
|
||||
language: &str,
|
||||
@@ -164,8 +162,8 @@ pub struct Message {
|
||||
}
|
||||
|
||||
impl Message {
|
||||
/// Construct a [Message] with the given type and a content string in the
|
||||
/// language given by [MessageContent::DEFAULT_LANGUAGE].
|
||||
/// Create a value with the given type and a content string in the language
|
||||
/// given by [`MessageContent::DEFAULT_LANGUAGE`].
|
||||
#[must_use]
|
||||
pub fn new(message_type: MessageType, content: String) -> Self {
|
||||
Self {
|
||||
@@ -175,9 +173,9 @@ impl Message {
|
||||
}
|
||||
}
|
||||
|
||||
/// Construct a [Message] with the given type and content. If more than one
|
||||
/// [MessageContent] object is given, one must use
|
||||
/// the language given by [MessageContent::DEFAULT_LANGUAGE].
|
||||
/// Create a value with the given type and content. If more than one
|
||||
/// `MessageContent` object is given, one must use
|
||||
/// the language given by [`MessageContent::DEFAULT_LANGUAGE`].
|
||||
pub fn multilingual(
|
||||
message_type: MessageType,
|
||||
content: Vec<MessageContent>,
|
||||
|
||||
@@ -25,9 +25,8 @@ pub struct PluginCleaningData {
|
||||
}
|
||||
|
||||
impl PluginCleaningData {
|
||||
/// Construct a [PluginCleaningData] object with the given CRC and cleaning
|
||||
/// utility, no detail and the ITM, deleted reference and deleted navmesh
|
||||
/// counts set to zero.
|
||||
/// Create a value with the given CRC and cleaning utility, no detail and
|
||||
/// the ITM, deleted reference and deleted navmesh counts set to zero.
|
||||
#[must_use]
|
||||
pub fn new(crc: u32, cleaning_utility: String) -> Self {
|
||||
Self {
|
||||
@@ -60,7 +59,7 @@ impl PluginCleaningData {
|
||||
|
||||
/// Set the detail message content, which may be appended to any messages
|
||||
/// generated for this cleaning data. If multilingual, one language must be
|
||||
/// [MessageContent::DEFAULT_LANGUAGE].
|
||||
/// [`MessageContent::DEFAULT_LANGUAGE`].
|
||||
pub fn with_detail(
|
||||
mut self,
|
||||
detail: Vec<MessageContent>,
|
||||
|
||||
@@ -36,8 +36,7 @@ pub struct PluginMetadata {
|
||||
}
|
||||
|
||||
impl PluginMetadata {
|
||||
/// Construct a [PluginMetadata] object with no metadata for a plugin with
|
||||
/// the given filename.
|
||||
/// Create a value with no metadata for a plugin with the given filename.
|
||||
pub fn new(name: &str) -> Result<Self, RegexError> {
|
||||
Ok(Self {
|
||||
name: PluginName::new(name)?,
|
||||
@@ -59,7 +58,7 @@ impl PluginMetadata {
|
||||
|
||||
/// Get the plugin's group.
|
||||
///
|
||||
/// The [Option] is `None` if no group is explicitly set.
|
||||
/// The `Option` is `None` if no group is explicitly set.
|
||||
pub fn group(&self) -> Option<&str> {
|
||||
self.group.as_deref()
|
||||
}
|
||||
@@ -155,9 +154,9 @@ impl PluginMetadata {
|
||||
self.locations = locations.into_boxed_slice();
|
||||
}
|
||||
|
||||
/// Merge metadata from the given [PluginMetadata] object into this object.
|
||||
/// Merge metadata from the given `PluginMetadata` object into this object.
|
||||
///
|
||||
/// If an equal metadata object already exists in this PluginMetadata
|
||||
/// If an equal metadata object already exists in this `PluginMetadata`
|
||||
/// object, it is not duplicated. This object's group is replaced by the
|
||||
/// given object's group if the latter is explicit.
|
||||
pub fn merge_metadata(&mut self, plugin: &PluginMetadata) {
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ pub struct Tag {
|
||||
}
|
||||
|
||||
impl Tag {
|
||||
/// Create a [Tag] suggestion for the given tag name.
|
||||
/// Create a Bash Tag suggestion for the given tag name.
|
||||
#[must_use]
|
||||
pub fn new(name: String, suggestion: TagSuggestion) -> Self {
|
||||
Self {
|
||||
|
||||
@@ -196,8 +196,8 @@ pub(in crate::metadata) fn parse_condition(
|
||||
}
|
||||
}
|
||||
|
||||
/// This is effectively TryFrom<&MarkedYaml>, but implementing it doesn't make
|
||||
/// MarkedYaml part of the crate's public API.
|
||||
// This is effectively TryFrom<&MarkedYaml>, but implementing it doesn't make
|
||||
// MarkedYaml part of the crate's public API.
|
||||
pub(in crate::metadata) trait TryFromYaml: Sized {
|
||||
fn try_from_yaml(value: &MarkedYaml) -> Result<Self, ParseMetadataError>;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ pub struct Vertex {
|
||||
}
|
||||
|
||||
impl Vertex {
|
||||
/// Construct a Vertex with the given name and no out edge.
|
||||
/// Create a value with the given name and no out edge.
|
||||
#[must_use]
|
||||
pub fn new(name: String) -> Self {
|
||||
Self {
|
||||
|
||||
Reference in New Issue
Block a user