Skip to content

Commit

Permalink
Fix some clippy::doc_markdown lints in masonry.
Browse files Browse the repository at this point in the history
This is a start on linebender#449.
  • Loading branch information
waywardmonkeys committed Aug 2, 2024
1 parent dd938d4 commit 71107ac
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
8 changes: 4 additions & 4 deletions masonry/src/testing/harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ impl TestHarness {

// --- MARK: EVENT HELPERS ---

/// Move an internal mouse state, and send a MouseMove event to the window.
/// Move an internal mouse state, and send a [`PointerEvent::PointerMove`] event to the window.
pub fn mouse_move(&mut self, pos: impl Into<Point>) {
// FIXME - Account for scaling
let pos = pos.into();
Expand All @@ -349,19 +349,19 @@ impl TestHarness {
self.process_pointer_event(PointerEvent::PointerMove(self.mouse_state.clone()));
}

/// Send a MouseDown event to the window.
/// Send a [`PointerEvent::PointerDown`] event to the window.
pub fn mouse_button_press(&mut self, button: PointerButton) {
self.mouse_state.buttons.insert(button);
self.process_pointer_event(PointerEvent::PointerDown(button, self.mouse_state.clone()));
}

/// Send a MouseUp event to the window.
/// Send a [`PointerEvent::PointerUp`] event to the window.
pub fn mouse_button_release(&mut self, button: PointerButton) {
self.mouse_state.buttons.remove(&button);
self.process_pointer_event(PointerEvent::PointerUp(button, self.mouse_state.clone()));
}

/// Send a Wheel event to the window
/// Send a [`PointerEvent::MouseWheel`] event to the window.
pub fn mouse_wheel(&mut self, wheel_delta: Vec2) {
let pixel_delta = LogicalPosition::new(wheel_delta.x, wheel_delta.y);
self.process_pointer_event(PointerEvent::MouseWheel(
Expand Down
2 changes: 1 addition & 1 deletion masonry/src/text/backspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use xi_unicode::*;
use super::{EditableTextCursor, Selectable};

/// Logic adapted from Android and
/// https://github.com/xi-editor/xi-editor/pull/837
/// <https://github.com/xi-editor/xi-editor/pull/837>
/// See links present in that PR for upstream Android Source
/// Matches Android Logic as at 2024-05-10
#[allow(clippy::cognitive_complexity)]
Expand Down
2 changes: 1 addition & 1 deletion masonry/src/text/edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl<T: EditableText> TextEditor<T> {

/// Rebuild the text.
///
/// See also [TextLayout::rebuild](crate::text2::TextLayout::rebuild) for more comprehensive docs.
/// See also [`TextLayout::rebuild()`](crate::text::TextLayout::rebuild) for more comprehensive docs.
pub fn rebuild(
&mut self,
font_ctx: &mut FontContext,
Expand Down
4 changes: 2 additions & 2 deletions masonry/src/text/selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ impl<T: Selectable> TextWithSelection<T> {

/// Rebuild the text layout.
///
/// See also [TextLayout::rebuild] for more comprehensive docs.
/// See also [`TextLayout::rebuild()`] for more comprehensive docs.
pub fn rebuild(
&mut self,
font_ctx: &mut FontContext,
Expand All @@ -223,7 +223,7 @@ impl<T: Selectable> TextWithSelection<T> {
// Intentionally aliases the method on `TextLayout`
/// Rebuild the text layout, adding attributes to the builder.
///
/// See also [TextLayout::rebuild_with_attributes] for more comprehensive docs.
/// See also [`TextLayout::rebuild_with_attributes()`] for more comprehensive docs.
pub fn rebuild_with_attributes(
&mut self,
font_ctx: &mut FontContext,
Expand Down
5 changes: 2 additions & 3 deletions masonry/src/tree_arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct TreeArena<Item> {

/// A reference type giving shared access to an item's children.
///
/// When you borrow an item from a TreeArena, you get two values, returned
/// When you borrow an item from a [`TreeArena`], you get two values, returned
/// separately for lifetime reasons: a reference to the item itself, and a token
/// to access its children.
pub struct TreeArenaToken<'a, Item> {
Expand All @@ -52,10 +52,9 @@ impl<'a, Item> Copy for TreeArenaToken<'a, Item> {}

/// A reference type giving mutable access to an item's children.
///
/// When you borrow an item from a TreeArena, you get two values, returned
/// When you borrow an item from a [`TreeArena`], you get two values, returned
/// separately for lifetime reasons: a reference to the item itself, and a token
/// to access its children.
pub struct TreeArenaTokenMut<'a, Item> {
children: &'a mut Vec<TreeNode<Item>>,
}
Expand Down
4 changes: 2 additions & 2 deletions masonry/src/widget/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub struct WidgetId(pub(crate) NonZeroU64);
/// for details **(TODO)**.
///
/// Generally speaking, widgets aren't used directly. They are stored in
/// [`WidgetPods`](crate::WidgetPod). Widget methods are called by WidgetPods, and the
/// [`WidgetPod`](crate::WidgetPod)s. Widget methods are called by `WidgetPod`s, and the
/// widget is mutated either during a method call (eg `on_event` or `lifecycle`) or
/// through a [`WidgetMut`](crate::widget::WidgetMut). See tutorials for details.
pub trait Widget: AsAny {
Expand Down Expand Up @@ -217,7 +217,7 @@ pub trait Widget: AsAny {
/// responsible for calling the context methods (eg `request_layout`,
/// `request_accessibility_update`) for the child.
///
/// Widgets implementing AllowRawMut are usually private widgets used as an
/// Widgets implementing `AllowRawMut` are usually private widgets used as an
/// internal implementation detail of public widgets.
pub trait AllowRawMut: Widget {}

Expand Down

0 comments on commit 71107ac

Please sign in to comment.