From cefc3831230534743dddd26957e4b566d677e83e Mon Sep 17 00:00:00 2001 From: Serial <69764315+Serial-ATA@users.noreply.github.com> Date: Sun, 9 Jan 2022 09:57:32 -0500 Subject: [PATCH] Fix some doc comments --- src/ape/tag/ape_tag.rs | 6 +++--- src/id3/v1/mod.rs | 2 +- src/id3/v2/items/sync_text.rs | 4 ++-- src/id3/v2/mod.rs | 2 +- src/id3/v2/util/text_utils.rs | 2 +- src/iff/aiff/tag.rs | 8 ++++---- src/lib.rs | 1 - src/mp4/ilst/mod.rs | 6 +++--- src/types/file.rs | 10 +++++----- src/types/item.rs | 2 +- src/types/picture.rs | 12 ++++++------ src/types/tag.rs | 4 ++-- 12 files changed, 29 insertions(+), 30 deletions(-) diff --git a/src/ape/tag/ape_tag.rs b/src/ape/tag/ape_tag.rs index 81fd9ac2..814802b4 100644 --- a/src/ape/tag/ape_tag.rs +++ b/src/ape/tag/ape_tag.rs @@ -54,19 +54,19 @@ macro_rules! impl_accessor { /// /// ## Item storage /// -/// `APE` isn't a very strict format. An [ApeItem] only restricted by its name, meaning it can use +/// `APE` isn't a very strict format. An [`ApeItem`] only restricted by its name, meaning it can use /// a normal [`ItemValue`](crate::ItemValue) unlike other formats. /// /// Pictures are stored as [`ItemValue::Binary`](crate::ItemValue::Binary), and can be converted with /// [`Picture::from_ape_bytes`](crate::Picture::from_ape_bytes). For the appropriate item keys, see -/// [APE_PICTURE_TYPES](crate::ape::APE_PICTURE_TYPES). +/// [`APE_PICTURE_TYPES`](crate::ape::APE_PICTURE_TYPES). /// /// ## Conversions /// /// ### From `Tag` /// /// When converting pictures, any of type [`PictureType::Undefined`](crate::PictureType::Undefined) will be discarded. -/// For items, see [ApeItem::new]. +/// For items, see [`ApeItem::new`]. pub struct ApeTag { /// Whether or not to mark the tag as read only pub read_only: bool, diff --git a/src/id3/v1/mod.rs b/src/id3/v1/mod.rs index 219bf549..3d3c5f00 100644 --- a/src/id3/v1/mod.rs +++ b/src/id3/v1/mod.rs @@ -2,7 +2,7 @@ //! //! # ID3v1 notes //! -//! See also: [Id3v1Tag] +//! See also: [`Id3v1Tag`] //! //! ## Genres //! diff --git a/src/id3/v2/items/sync_text.rs b/src/id3/v2/items/sync_text.rs index dde20430..d9e780a9 100644 --- a/src/id3/v2/items/sync_text.rs +++ b/src/id3/v2/items/sync_text.rs @@ -19,7 +19,7 @@ pub enum TimestampFormat { } impl TimestampFormat { - /// Get a TimestampFormat from a u8, must be 1-2 inclusive + /// Get a `TimestampFormat` from a u8, must be 1-2 inclusive pub fn from_u8(byte: u8) -> Option { match byte { 1 => Some(Self::MPEG), @@ -46,7 +46,7 @@ pub enum SyncTextContentType { } impl SyncTextContentType { - /// Get a SyncTextContentType from a u8, must be 0-8 inclusive + /// Get a `SyncTextContentType` from a u8, must be 0-8 inclusive pub fn from_u8(byte: u8) -> Option { match byte { 0 => Some(Self::Other), diff --git a/src/id3/v2/mod.rs b/src/id3/v2/mod.rs index 4e9f4a8b..aefd6d4e 100644 --- a/src/id3/v2/mod.rs +++ b/src/id3/v2/mod.rs @@ -4,7 +4,7 @@ //! //! See: //! -//! * [Id3v2Tag] +//! * [`Id3v2Tag`] //! * [Frame] mod flags; diff --git a/src/id3/v2/util/text_utils.rs b/src/id3/v2/util/text_utils.rs index 3c9391bb..e451fb0c 100644 --- a/src/id3/v2/util/text_utils.rs +++ b/src/id3/v2/util/text_utils.rs @@ -21,7 +21,7 @@ pub enum TextEncoding { } impl TextEncoding { - /// Get a TextEncoding from a u8, must be 0-3 inclusive + /// Get a `TextEncoding` from a u8, must be 0-3 inclusive #[allow(unused)] pub fn from_u8(byte: u8) -> Option { match byte { diff --git a/src/iff/aiff/tag.rs b/src/iff/aiff/tag.rs index 0f7d45d1..cf6595e8 100644 --- a/src/iff/aiff/tag.rs +++ b/src/iff/aiff/tag.rs @@ -48,10 +48,10 @@ pub struct Comment { /// /// When converting from [`Tag`](crate::Tag), the following [`ItemKey`](crate::ItemKey)s will be used: /// -/// * [ItemKey::TrackTitle](crate::ItemKey::TrackTitle) -/// * [ItemKey::TrackArtist](crate::ItemKey::TrackArtist) -/// * [ItemKey::CopyrightMessage](crate::ItemKey::CopyrightMessage) -/// * [ItemKey::Comment](crate::ItemKey::Comment) +/// * [`ItemKey::TrackTitle`](crate::ItemKey::TrackTitle) +/// * [`ItemKey::TrackArtist`](crate::ItemKey::TrackArtist) +/// * [`ItemKey::CopyrightMessage`](crate::ItemKey::CopyrightMessage) +/// * [`ItemKey::Comment`](crate::ItemKey::Comment) /// /// When converting [Comment]s, only the `text` field will be preserved. #[derive(Default, Clone, Debug, PartialEq)] diff --git a/src/lib.rs b/src/lib.rs index 66252ae3..47b98a8a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -143,7 +143,6 @@ clippy::match_wildcard_for_single_variants, clippy::semicolon_if_nothing_returned, clippy::new_without_default, - clippy::unused_self, clippy::from_over_into, clippy::upper_case_acronyms, clippy::too_many_arguments, diff --git a/src/mp4/ilst/mod.rs b/src/mp4/ilst/mod.rs index b6736d10..e8f80fa2 100644 --- a/src/mp4/ilst/mod.rs +++ b/src/mp4/ilst/mod.rs @@ -60,16 +60,16 @@ macro_rules! impl_accessor { /// ## Pictures /// /// Unlike other formats, ilst does not store a [`PictureType`]. All pictures will have -/// [PictureType::Other]. +/// [`PictureType::Other`]. /// /// ## Conversions /// /// ### To `Tag` /// -/// When converting to [`Tag`], only atoms with a value of [AtomData::UTF8] and [AtomData::UTF16], as +/// When converting to [`Tag`], only atoms with a value of [`AtomData::UTF8`] and [`AtomData::UTF16`], as /// well as pictures, will be preserved. /// -/// Do note, all pictures will be [PictureType::Other](crate::PictureType::Other) +/// Do note, all pictures will be [`PictureType::Other`](crate::PictureType::Other) /// /// ### From `Tag` /// diff --git a/src/types/file.rs b/src/types/file.rs index 1bfdb50a..2ba78b62 100644 --- a/src/types/file.rs +++ b/src/types/file.rs @@ -56,14 +56,14 @@ pub struct TaggedFile { impl TaggedFile { /// Returns the primary tag /// - /// See [FileType::primary_tag_type] + /// See [`FileType::primary_tag_type`] pub fn primary_tag(&self) -> Option<&Tag> { self.tag(&self.primary_tag_type()) } /// Gets a mutable reference to the file's "Primary tag" /// - /// See [FileType::primary_tag_type] + /// See [`FileType::primary_tag_type`] pub fn primary_tag_mut(&mut self) -> Option<&mut Tag> { self.tag_mut(&self.primary_tag_type()) } @@ -71,7 +71,7 @@ impl TaggedFile { #[allow(unreachable_patterns, clippy::match_same_arms)] /// Returns the file type's primary [`TagType`] /// - /// See [FileType::primary_tag_type] + /// See [`FileType::primary_tag_type`] pub fn primary_tag_type(&self) -> TagType { self.ty.primary_tag_type() } @@ -141,7 +141,7 @@ impl TaggedFile { /// /// # Errors /// - /// See [TaggedFile::save_to] + /// See [`TaggedFile::save_to`] pub fn save_to_path(&self, path: impl AsRef) -> Result<()> { self.save_to(&mut OpenOptions::new().read(true).write(true).open(path)?) } @@ -215,7 +215,7 @@ impl FileType { } } - /// Returns if the target FileType supports a [`TagType`] + /// Returns if the target `FileType` supports a [`TagType`] pub fn supports_tag_type(&self, tag_type: &TagType) -> bool { match self { #[cfg(feature = "id3v2")] diff --git a/src/types/item.rs b/src/types/item.rs index c2e86c7f..abbc6823 100644 --- a/src/types/item.rs +++ b/src/types/item.rs @@ -356,7 +356,7 @@ macro_rules! gen_item_keys { } impl ItemKey { - /// Map a format specific key to an ItemKey + /// Map a format specific key to an `ItemKey` /// /// NOTE: If used with ID3v2, this will only check against the ID3v2.4 keys. /// If you wish to use a V2 or V3 key, see [`upgrade_v2`](crate::id3::v2::upgrade_v2) and [`upgrade_v3`](crate::id3::v2::upgrade_v3) diff --git a/src/types/picture.rs b/src/types/picture.rs index 05f1fa38..31e458a2 100644 --- a/src/types/picture.rs +++ b/src/types/picture.rs @@ -80,7 +80,7 @@ impl ToString for MimeType { impl MimeType { #[allow(clippy::should_implement_trait)] - /// Get a MimeType from a string + /// Get a `MimeType` from a string pub fn from_str(mime_type: &str) -> Self { match &*mime_type.to_lowercase() { "image/jpeg" => Self::Jpeg, @@ -93,7 +93,7 @@ impl MimeType { } } - /// Get a &str from a MimeType + /// Get a &str from a `MimeType` pub fn as_str(&self) -> &str { match self { MimeType::Jpeg => "image/jpeg", @@ -138,7 +138,7 @@ pub enum PictureType { impl PictureType { // ID3/OGG specific methods - /// Get a u8 from a PictureType according to ID3v2 APIC + /// Get a u8 from a `PictureType` according to ID3v2 APIC #[cfg(any(feature = "id3v2", feature = "vorbis_comments"))] pub fn as_u8(&self) -> u8 { match self { @@ -167,7 +167,7 @@ impl PictureType { } } - /// Get a PictureType from a u8 according to ID3v2 APIC + /// Get a `PictureType` from a u8 according to ID3v2 APIC #[cfg(any(feature = "id3v2", feature = "vorbis_comments"))] pub fn from_u8(bytes: u8) -> Self { match bytes { @@ -198,7 +198,7 @@ impl PictureType { // APE specific methods - /// Get an APE item key from a PictureType + /// Get an APE item key from a `PictureType` #[cfg(feature = "ape")] pub fn as_ape_key(&self) -> Option<&str> { match self { @@ -227,7 +227,7 @@ impl PictureType { } } - /// Get a PictureType from an APE item key + /// Get a `PictureType` from an APE item key #[cfg(feature = "ape")] pub fn from_ape_key(key: &str) -> Self { match key { diff --git a/src/types/tag.rs b/src/types/tag.rs index 10068877..99817395 100644 --- a/src/types/tag.rs +++ b/src/types/tag.rs @@ -59,14 +59,14 @@ macro_rules! impl_accessor { #[derive(Clone)] /// Represents a parsed tag /// -/// This is a tag that is loosely bound to a specific [TagType]. +/// This is a tag that is loosely bound to a specific [`TagType`]. /// It is used for conversions and as the return type for [`read_from`](crate::read_from). /// /// Compared to other formats, this gives a much higher-level view of the /// tag items. Rather than storing items according to their format-specific /// keys, [`ItemKey`]s are used. /// -/// You can easily remap this to another [TagType] with [Tag::re_map]. +/// You can easily remap this to another [`TagType`] with [`Tag::re_map`]. /// /// Any conversion will, of course, be lossy to a varying degree. ///