Skip to content

Commit

Permalink
Fix intra-doc links
Browse files Browse the repository at this point in the history
  • Loading branch information
str4d committed Jun 9, 2023
1 parent 10722bf commit c711bb7
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 29 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/_lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,19 @@ jobs:
- uses: actions/checkout@v3
- name: Install build dependencies
run: sudo apt install libudev-dev
# Use nightly Rust (as docs.rs does), because some of our dependencies enable the
# `doc_cfg` feature when the `docsrs` config option is set.
- uses: dtolnay/rust-toolchain@nightly
id: toolchain
with:
targets: thumbv7em-none-eabihf
- run: rustup override set ${{ steps.toolchain.outputs.name }}
- run: cargo fetch
# Requires #![deny(rustdoc::broken_intra_doc_links)] in crates.
- name: Check intra-doc links
run: cargo doc --workspace --document-private-items
env:
RUSTDOCFLAGS: --cfg docsrs

fmt:
name: Rustfmt
Expand Down
33 changes: 13 additions & 20 deletions crates/flipperzero/src/furi/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ const WHITESPACE: &[char] = &[
/// allocator. Very short strings (7 bytes or fewer) are stored directly inside the
/// `FuriString` struct (which is stored on the heap), while longer strings are allocated
/// on the heap by the Flipper Zero firmware.
///
/// [`CString`]: alloc::ffi::CString
/// [`String`]: alloc::string::String
#[derive(Eq)]
pub struct FuriString(NonNull<sys::FuriString>);

Expand Down Expand Up @@ -296,11 +299,10 @@ impl FuriString {
///
/// Returns `false` if it does not.
///
/// The [pattern] can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// The pattern can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// [`char`]s.
///
/// [`char`]: prim@char
/// [pattern]: self::pattern
#[inline]
pub fn contains<P: Pattern>(&self, pat: P) -> bool {
pat.is_contained_in(self)
Expand All @@ -310,11 +312,10 @@ impl FuriString {
///
/// Returns `false` if it does not.
///
/// The [pattern] can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// The pattern can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// [`char`]s.
///
/// [`char`]: prim@char
/// [pattern]: self::pattern
pub fn starts_with<P: Pattern>(&self, pat: P) -> bool {
pat.is_prefix_of(self)
}
Expand All @@ -323,11 +324,10 @@ impl FuriString {
///
/// Returns `false` if it does not.
///
/// The [pattern] can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// The pattern can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// [`char`]s.
///
/// [`char`]: prim@char
/// [pattern]: self::pattern
pub fn ends_with<P: Pattern>(&self, pat: P) -> bool {
pat.is_suffix_of(self)
}
Expand All @@ -336,11 +336,10 @@ impl FuriString {
///
/// Returns [`None`] if the pattern doesn't match.
///
/// The [pattern] can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// The pattern can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// [`char`]s.
///
/// [`char`]: prim@char
/// [pattern]: self::pattern
#[inline]
pub fn find<P: Pattern>(&self, pat: P) -> Option<usize> {
pat.find_in(self)
Expand All @@ -351,11 +350,10 @@ impl FuriString {
///
/// Returns [`None`] if the pattern doesn't match.
///
/// The [pattern] can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// The pattern can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// [`char`]s.
///
/// [`char`]: prim@char
/// [pattern]: self::pattern
#[inline]
pub fn rfind<P: Pattern>(&self, pat: P) -> Option<usize> {
pat.rfind_in(self)
Expand Down Expand Up @@ -404,23 +402,21 @@ impl FuriString {

/// Repeatedly removes from this string all prefixes and suffixes that match a pattern.
///
/// The [pattern] can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// The pattern can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// [`char`]s.
///
/// [`char`]: prim@char
/// [pattern]: self::pattern
pub fn trim_matches<P: Pattern + Copy>(&mut self, pat: P) {
self.trim_start_matches(pat);
self.trim_end_matches(pat);
}

/// Repeatedly removes from this string all prefixes that match a pattern.
///
/// The [pattern] can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// The pattern can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// [`char`]s.
///
/// [`char`]: prim@char
/// [pattern]: self::pattern
///
/// # Text directionality
///
Expand All @@ -434,11 +430,10 @@ impl FuriString {

/// Repeatedly removes from this string all suffixes that match a pattern.
///
/// The [pattern] can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// The pattern can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// [`char`]s.
///
/// [`char`]: prim@char
/// [pattern]: self::pattern
///
/// # Text directionality
///
Expand All @@ -457,11 +452,10 @@ impl FuriString {
///
/// If the string does not start with `prefix`, returns `false`.
///
/// The [pattern] can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// The pattern can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// [`char`]s.
///
/// [`char`]: prim@char
/// [pattern]: self::pattern
#[must_use]
pub fn strip_prefix<P: Pattern>(&mut self, prefix: P) -> bool {
prefix.strip_prefix_of(self)
Expand All @@ -474,11 +468,10 @@ impl FuriString {
///
/// If the string does not end with `suffix`, returns `false`.
///
/// The [pattern] can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// The pattern can be a `&FuriString`, [`c_char`], `&CStr`, [`char`], or a slice of
/// [`char`]s.
///
/// [`char`]: prim@char
/// [pattern]: self::pattern
#[must_use]
pub fn strip_suffix<P: Pattern>(&mut self, suffix: P) -> bool {
suffix.strip_suffix_of(self)
Expand Down
13 changes: 8 additions & 5 deletions crates/flipperzero/src/furi/string/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ pub unsafe fn next_code_point<'a, I: Iterator<Item = &'a u8>>(bytes: &mut I) ->

/// An iterator over the [`char`]s of a string.
///
/// This struct is created by the [`chars`] method on [`FuriString`]. See its
/// This struct is created by the [`chars_lossy`] method on [`FuriString`]. See its
/// documentation for more.
///
/// [`char`]: prim@char
/// [`chars`]: FuriString::chars
/// [`chars_lossy`]: super::FuriString::chars_lossy
/// [`FuriString`]: super::FuriString
#[derive(Clone)]
#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct Chars<'a> {
Expand Down Expand Up @@ -65,11 +66,12 @@ impl FusedIterator for Chars<'_> {}

/// An iterator over the [`char`]s of a string, and their positions.
///
/// This struct is created by the [`char_indices`] method on [`FuriString`]. See its
/// This struct is created by the [`char_indices_lossy`] method on [`FuriString`]. See its
/// documentation for more.
///
/// [`char`]: prim@char
/// [`char_indices`]: FuriString::char_indices
/// [`char_indices_lossy`]: super::FuriString::char_indices_lossy
/// [`FuriString`]: super::FuriString
#[derive(Clone, Debug)]
#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct CharIndices<'a> {
Expand Down Expand Up @@ -112,7 +114,8 @@ impl FusedIterator for CharIndices<'_> {}
/// This struct is created by the [`bytes`] method on [`FuriString`]. See its
/// documentation for more.
///
/// [`bytes`]: FuriString::bytes
/// [`bytes`]: super::FuriString::bytes
/// [`FuriString`]: super::FuriString
#[must_use = "iterators are lazy and do nothing unless consumed"]
#[derive(Clone, Debug)]
pub struct Bytes<'a>(pub(super) Copied<slice::Iter<'a, u8>>);
Expand Down
2 changes: 1 addition & 1 deletion crates/flipperzero/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#![cfg_attr(test, no_main)]
#![deny(rustdoc::broken_intra_doc_links)]

#[cfg(feature = "alloc")]
#[cfg(any(feature = "alloc", docsrs))]
extern crate alloc;

pub mod dialogs;
Expand Down
2 changes: 2 additions & 0 deletions crates/flipperzero/src/toolbox/crc32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use flipperzero_sys as sys;
/// Equivalent to [`crc32fast::Hasher`].
///
/// [1]: https://en.wikipedia.org/wiki/Cyclic_redundancy_check
///
/// [`crc32fast::Hasher`]: https://docs.rs/crc32fast/latest/crc32fast/struct.Hasher.html
#[derive(Clone)]
pub struct Crc32 {
state: u32,
Expand Down
2 changes: 2 additions & 0 deletions crates/flipperzero/src/toolbox/md5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ use flipperzero_sys as sys;
/// [2]: https://www.kb.cert.org/vuls/id/836068
/// [3]: https://dl.acm.org/citation.cfm?id=1724151
/// [4]: https://tools.ietf.org/html/rfc6151
///
/// [`md5::Md5`]: https://docs.rs/md-5/latest/md5/type.Md5.html
pub type Md5 = CoreWrapper<Md5Core>;

/// Core MD5 hasher.
Expand Down
2 changes: 2 additions & 0 deletions crates/flipperzero/src/toolbox/sha256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ use flipperzero_sys as sys;
/// Equivalent to [`sha2::Sha256`].
///
/// [1]: https://en.wikipedia.org/wiki/SHA-2
///
/// [`sha2::Sha256`]: https://docs.rs/sha2/latest/sha2/type.Sha256.html
pub type Sha256 = CoreWrapper<Sha256Core>;

/// Core block-level SHA-256 hasher.
Expand Down
2 changes: 1 addition & 1 deletion crates/sys/src/inlines/furi_hal_gpio.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Inlines for Furi HAL GPIO interface.
//!
//! See: https://github.com/flipperdevices/flipperzero-firmware/blob/release/firmware/targets/f7/furi_hal/furi_hal_gpio.h
//! See: <https://github.com/flipperdevices/flipperzero-firmware/blob/release/firmware/targets/f7/furi_hal/furi_hal_gpio.h>
use crate as sys;

Expand Down
2 changes: 1 addition & 1 deletion tools/src/bin/run-fap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct Cli {

/// Arguments to provide to the FAP binary.
///
/// Ignored until https://github.com/flipperdevices/flipperzero-firmware/issues/2505 is resolved.
/// Ignored until <https://github.com/flipperdevices/flipperzero-firmware/issues/2505> is resolved.
args: Vec<String>,
}

Expand Down
2 changes: 1 addition & 1 deletion tools/src/bin/storage.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Storage CLI.
//!
//! See: https://github.com/flipperdevices/flipperzero-firmware/blob/dev/scripts/storage.py
//! See: <https://github.com/flipperdevices/flipperzero-firmware/blob/dev/scripts/storage.py>
use std::path::PathBuf;
use std::process;
Expand Down

0 comments on commit c711bb7

Please sign in to comment.