From 1c883c5a9ea21aca6579ba817b55c4e58b2d6736 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Sat, 19 Aug 2023 18:45:19 +0700 Subject: [PATCH] Use intradoc links, suppress generated doc warnings. (#218) * harfbuzz-sys: Suppress doc warnings from generated bindings. * docs: Update to intradoc link syntax. --- harfbuzz-sys/src/lib.rs | 2 ++ harfbuzz/src/buffer.rs | 47 +++++++++++++++++---------------------- harfbuzz/src/direction.rs | 29 ++++++------------------ 3 files changed, 30 insertions(+), 48 deletions(-) diff --git a/harfbuzz-sys/src/lib.rs b/harfbuzz-sys/src/lib.rs index 8730e192..50684d2b 100644 --- a/harfbuzz-sys/src/lib.rs +++ b/harfbuzz-sys/src/lib.rs @@ -17,6 +17,8 @@ extern "C" { #[allow(non_snake_case)] #[allow(non_upper_case_globals)] #[allow(clippy::unreadable_literal)] +#[allow(rustdoc::bare_urls)] +#[allow(rustdoc::broken_intra_doc_links)] mod bindings; pub use crate::bindings::*; diff --git a/harfbuzz/src/buffer.rs b/harfbuzz/src/buffer.rs index 9db4b512..4b4a8b88 100644 --- a/harfbuzz/src/buffer.rs +++ b/harfbuzz/src/buffer.rs @@ -39,20 +39,20 @@ use crate::{Direction, Language}; /// /// * Direction: The direction in which the output glyphs flow. This is /// typically left to right or right to left. This is controlled via -/// the [`set_direction`] method on `Buffer`. +/// the [`Buffer::set_direction()`] method. /// * Script: Script is crucial for choosing the proper shaping behaviour /// for scripts that require it (e.g. Arabic) and the which OpenType /// features defined in the font to be applied. This is controlled via -/// the [`set_script`] method on `Buffer`. +/// the [`Buffer::set_script()`] method. /// * Language: Languages are crucial for selecting which OpenType feature /// to apply to the buffer which can result in applying language-specific /// behaviour. Languages are orthogonal to the scripts, and though they /// are related, they are different concepts and should not be confused -/// with each other. This is controlled via the [`set_language`] method -/// on `Buffer`. +/// with each other. This is controlled via the [`Buffer::set_language()`] +/// method. /// /// Additionally, Harfbuzz can attempt to infer the values for these -/// properties using the [`guess_segment_properties`] method on `Buffer`: +/// properties using the [`Buffer::guess_segment_properties()`] method: /// /// ``` /// # use harfbuzz::{Buffer, Direction, sys}; @@ -61,11 +61,6 @@ use crate::{Direction, Language}; /// assert_eq!(b.get_direction(), Direction::RTL); /// assert_eq!(b.get_script(), sys::HB_SCRIPT_ARABIC); /// ``` -/// -/// [`set_direction`]: #method.set_direction -/// [`set_script`]: #method.set_script -/// [`set_language`]: #method.set_language -/// [`guess_segment_properties`]: #method.guess_segment_properties pub struct Buffer { /// The underlying `hb_buffer_t` from the `harfbuzz-sys` crate. /// @@ -193,7 +188,7 @@ impl Buffer { /// that has a script other than `HB_SCRIPT_COMMON`, /// `HB_SCRIPT_INHERITED`, and `HB_SCRIPT_UNKNOWN`. /// - /// Next, if buffer direction is not set (ie. is `Direction::Invalid`), + /// Next, if buffer direction is not set (ie. is [`Direction::Invalid`]), /// it will be set to the natural horizontal direction of the buffer /// script as returned by `hb_script_get_horizontal_direction()`. /// @@ -212,12 +207,12 @@ impl Buffer { /// /// See also: /// - /// * [`get_direction`](#method.get_direction) - /// * [`set_direction`](#method.set_direction) - /// * [`get_script`](#method.get_script) - /// * [`set_script`](#method.set_script) - /// * [`get_language`](#method.get_language) - /// * [`set_language`](#method.set_language) + /// * [`Buffer::get_direction`] + /// * [`Buffer::set_direction`] + /// * [`Buffer::get_script`] + /// * [`Buffer::set_script`] + /// * [`Buffer::get_language`] + /// * [`Buffer::set_language`] pub fn guess_segment_properties(&mut self) { unsafe { sys::hb_buffer_guess_segment_properties(self.raw) }; } @@ -234,8 +229,8 @@ impl Buffer { /// /// See also: /// - /// * [`get_direction`](#method.get_direction) - /// * [`guess_segment_properties`](#method.guess_segment_properties) + /// * [`Buffer::get_direction()`] + /// * [`Buffer::guess_segment_properties()`] pub fn set_direction(&mut self, direction: Direction) { unsafe { sys::hb_buffer_set_direction(self.raw, direction.into()) }; } @@ -244,7 +239,7 @@ impl Buffer { /// /// See also: /// - /// * [`set_direction`](#method.set_direction) + /// * [`Buffer::set_direction()`] pub fn get_direction(&self) -> Direction { (unsafe { sys::hb_buffer_get_direction(self.raw) }).into() } @@ -257,8 +252,8 @@ impl Buffer { /// /// See also: /// - /// * [`get_script`](#method.get_script) - /// * [`guess_segment_properties`](#method.guess_segment_properties) + /// * [`Buffer::get_script()`] + /// * [`Buffer::guess_segment_properties()`] pub fn set_script(&mut self, script: sys::hb_script_t) { unsafe { sys::hb_buffer_set_script(self.raw, script) }; } @@ -267,7 +262,7 @@ impl Buffer { /// /// See also: /// - /// * [`set_script`](#method.set_script) + /// * [`Buffer::set_script()`] pub fn get_script(&self) -> sys::hb_script_t { unsafe { sys::hb_buffer_get_script(self.raw) } } @@ -282,8 +277,8 @@ impl Buffer { /// /// See also: /// - /// * [`get_language`](#method.get_language) - /// * [`guess_segment_properties`](#method.guess_segment_properties) + /// * [`Buffer::get_language()`] + /// * [`Buffer::guess_segment_properties()`] pub fn set_language(&mut self, language: Language) { unsafe { sys::hb_buffer_set_language(self.raw, language.as_raw()) }; } @@ -292,7 +287,7 @@ impl Buffer { /// /// See also: /// - /// * [`set_language`](#method.set_language) + /// * [`Buffer::set_language()`] pub fn get_language(&self) -> Language { unsafe { Language::from_raw(sys::hb_buffer_get_language(self.raw)) } } diff --git a/harfbuzz/src/direction.rs b/harfbuzz/src/direction.rs index 009c397f..ea72b86a 100644 --- a/harfbuzz/src/direction.rs +++ b/harfbuzz/src/direction.rs @@ -11,8 +11,8 @@ use crate::sys; /// Direction of text flow during layout. /// -/// This maps to the [`hb_direction_t`] from -/// [`harfbuzz-sys`]. It can be converted to +/// This maps to the [`hb_direction_t`](crate::sys::hb_direction_t) from +/// [`harfbuzz-sys`](crate::sys). It can be converted to /// or from `hb_direction_t` using the [`From`] /// and [`Into`] traits: /// @@ -27,42 +27,27 @@ use crate::sys; /// let dir: Direction = sys::HB_DIRECTION_TTB.into(); /// assert_eq!(dir, Direction::TTB); /// ``` -/// -/// [`hb_direction_t`]: ../harfbuzz_sys/type.hb_direction_t.html -/// [`harfbuzz-sys`]: ../harfbuzz_sys/index.html -/// [`From`]: https://doc.rust-lang.org/std/convert/trait.From.html -/// [`Into`]: https://doc.rust-lang.org/std/convert/trait.Into.html #[derive(Copy, Clone, Debug, PartialEq, PartialOrd)] pub enum Direction { /// Initial, unset direction. /// - /// This corresponds to [`HB_DIRECTION_INVALID`]. - /// - /// [`HB_DIRECTION_INVALID`]: ../harfbuzz_sys/constant.HB_DIRECTION_INVALID.html + /// This corresponds to [`HB_DIRECTION_INVALID`](crate::sys::HB_DIRECTION_INVALID). Invalid, /// Text is set horizontally from left to right. /// - /// This corresponds to [`HB_DIRECTION_LTR`]. - /// - /// [`HB_DIRECTION_LTR`]: ../harfbuzz_sys/constant.HB_DIRECTION_LTR.html + /// This corresponds to [`HB_DIRECTION_LTR`](crate::sys::HB_DIRECTION_LTR). LTR, /// Text is set horizontally from right to left. /// - /// This corresponds to [`HB_DIRECTION_RTL`]. - /// - /// [`HB_DIRECTION_RTL`]: ../harfbuzz_sys/constant.HB_DIRECTION_RTL.html + /// This corresponds to [`HB_DIRECTION_RTL`](crate::sys::HB_DIRECTION_RTL). RTL, /// Text is set vertically from top to bottom. /// - /// This corresponds to [`HB_DIRECTION_TTB`]. - /// - /// [`HB_DIRECTION_TTB`]: ../harfbuzz_sys/constant.HB_DIRECTION_TTB.html + /// This corresponds to [`HB_DIRECTION_TTB`](crate::sys::HB_DIRECTION_TTB). TTB, /// Text is set vertically from bottom to top. /// - /// This corresponds to [`HB_DIRECTION_BTT`]. - /// - /// [`HB_DIRECTION_BTT`]: ../harfbuzz_sys/constant.HB_DIRECTION_BTT.html + /// This corresponds to [`HB_DIRECTION_BTT`](crate::sys::HB_DIRECTION_BTT). BTT, }