Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve doc formatting with more backticks. #4016

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions components/calendar/src/any_calendar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -884,14 +884,14 @@ pub enum AnyCalendarKind {
impl AnyCalendarKind {
/// Construct from a BCP-47 string
///
/// Returns None if the calendar is unknown. If you prefer an error, use
/// Returns `None` if the calendar is unknown. If you prefer an error, use
/// [`CalendarError::unknown_any_calendar_kind`].
pub fn get_for_bcp47_string(x: &str) -> Option<Self> {
Self::get_for_bcp47_bytes(x.as_bytes())
}
/// Construct from a BCP-47 byte string
///
/// Returns None if the calendar is unknown. If you prefer an error, use
/// Returns `None` if the calendar is unknown. If you prefer an error, use
/// [`CalendarError::unknown_any_calendar_kind`].
pub fn get_for_bcp47_bytes(x: &[u8]) -> Option<Self> {
Some(match x {
Expand Down Expand Up @@ -922,7 +922,7 @@ impl AnyCalendarKind {
}
/// Construct from a BCP-47 [`Value`]
///
/// Returns None if the calendar is unknown. If you prefer an error, use
/// Returns `None` if the calendar is unknown. If you prefer an error, use
/// [`CalendarError::unknown_any_calendar_kind`].
pub fn get_for_bcp47_value(x: &Value) -> Option<Self> {
let slice = x.as_tinystr_slice();
Expand Down Expand Up @@ -1043,7 +1043,7 @@ impl AnyCalendarKind {

/// Extract the calendar component from a [`Locale`]
///
/// Returns None if the calendar is not specified or unknown. If you prefer an error, use
/// Returns `None` if the calendar is not specified or unknown. If you prefer an error, use
/// [`CalendarError::unknown_any_calendar_kind`].
pub fn get_for_locale(l: &Locale) -> Option<Self> {
l.extensions
Expand All @@ -1055,7 +1055,7 @@ impl AnyCalendarKind {

/// Extract the calendar component from a [`DataLocale`]
///
/// Returns None if the calendar is not specified or unknown. If you prefer an error, use
/// Returns `None` if the calendar is not specified or unknown. If you prefer an error, use
/// [`CalendarError::unknown_any_calendar_kind`].
fn get_for_data_locale(l: &DataLocale) -> Option<Self> {
l.get_unicode_ext(&key!("ca"))
Expand Down
2 changes: 1 addition & 1 deletion components/calendar/src/calendar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub trait Calendar {
fn day_of_year_info(&self, date: &Self::DateInner) -> types::DayOfYearInfo;

/// The [`AnyCalendarKind`] corresponding to this calendar,
/// if one exists. Implementors outside of icu_calendar should return None
/// if one exists. Implementors outside of `icu_calendar` should return `None`
fn any_calendar_kind(&self) -> Option<AnyCalendarKind> {
None
}
Expand Down
10 changes: 5 additions & 5 deletions components/calendar/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ pub struct FormattableYear {
pub number: i32,

/// The year in the current cycle for cyclic calendars (1-indexed)
/// can be set to None for non-cyclic calendars
/// can be set to `None` for non-cyclic calendars
///
/// For chinese and dangi it will be
/// a number between 1 and 60, for hypothetical other calendars it may be something else.
Expand All @@ -67,7 +67,7 @@ pub struct FormattableYear {
/// The related ISO year. This is normally the ISO (proleptic Gregorian) year having the greatest
/// overlap with the calendar year. It is used in certain date formatting patterns.
///
/// Can be None if the calendar does not typically use related_iso (and CLDR does not contain patterns
/// Can be `None` if the calendar does not typically use `related_iso` (and CLDR does not contain patterns
/// using it)
pub related_iso: Option<i32>,
}
Expand Down Expand Up @@ -108,9 +108,9 @@ impl FormattableYear {
pub struct MonthCode(pub TinyStr4);

impl MonthCode {
/// Returns an option which is Some containing the non-month version of a leap month
/// if the MonthCode this method is called upon is a leap month, and None otherwise.
/// This method assumes the MonthCode is valid.
/// Returns an option which is `Some` containing the non-month version of a leap month
/// if the [`MonthCode`] this method is called upon is a leap month, and `None` otherwise.
/// This method assumes the [`MonthCode`] is valid.
pub fn get_normal_if_leap(self) -> Option<MonthCode> {
let bytes = self.0.all_bytes();
if bytes[3] == b'L' {
Expand Down
4 changes: 2 additions & 2 deletions components/casemap/src/provider/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ impl CaseType {

// The casetype is stored in the codepoint trie as two bits.
// After masking them to get a value between 0 and 3, this
// function converts to CaseType.
// function converts to `CaseType`.
//
// Returns None for uncased
// Returns `None` for uncased
#[inline]
pub(crate) fn from_masked_bits(b: u16) -> Option<Self> {
debug_assert!(b & Self::CASE_MASK == b);
Expand Down
14 changes: 7 additions & 7 deletions components/collections/src/char16trie/trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ fn skip_node_value(pos: usize, lead: u16) -> usize {
}
}

/// This struct represents a de-serialized Char16Trie that was exported from
/// This struct represents a de-serialized `Char16Trie` that was exported from
/// ICU binary data.
///
/// Light-weight, non-const reader class for a CharsTrie. Traverses a
/// Light-weight, non-const reader class for a `CharsTrie`. Traverses a
/// char-serialized data structure with minimal state, for mapping 16-bit-unit
/// sequences to non-negative integer values.
///
Expand Down Expand Up @@ -102,9 +102,9 @@ impl<'data> Char16Trie<'data> {
pub struct Char16TrieIterator<'a> {
/// A reference to the Char16Trie data to iterate over.
trie: &'a ZeroSlice<u16>,
/// Index of next trie unit to read, or None if there are no more matches.
/// Index of next trie unit to read, or `None` if there are no more matches.
pos: Option<usize>,
/// Remaining length of a linear-match node, minus 1, or None if not in
/// Remaining length of a linear-match node, minus 1, or `None` if not in
/// such a node.
remaining_match_length: Option<usize>,
}
Expand All @@ -113,8 +113,8 @@ pub struct Char16TrieIterator<'a> {
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TrieResult {
/// The input unit(s) did not continue a matching string.
/// Once next() returns TrieResult::NoMatch, all further calls to next()
/// will also return TrieResult::NoMatch.
/// Once `next()` returns `TrieResult::NoMatch`, all further calls to `next()`
/// will also return `TrieResult::NoMatch`.
NoMatch,
/// The input unit(s) matched a string but there is no value for the string
/// so far. (It is a prefix of a longer string.)
Expand Down Expand Up @@ -147,7 +147,7 @@ fn u16_tail(supplementary: i32) -> u16 {

/// A macro that takes an `Option` argument and either unwraps it if it has a value or
/// causes the function to return `TrieResult::NoMatch` if there is no value.
/// This could perhaps be done with std::ops::Try once stabilized.
/// This could perhaps be done with `std::ops::Try` once stabilized.
macro_rules! trie_unwrap {
($option:expr) => {
match $option {
Expand Down
2 changes: 1 addition & 1 deletion components/datetime/src/any/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl DateFormatter {

/// Converts a date to the correct calendar if necessary
///
/// Returns Err if the date is not ISO or compatible with the current calendar, returns Ok(None)
/// Returns `Err` if the date is not ISO or compatible with the current calendar, returns `Ok(None)`
/// if the date is compatible with the current calendar and doesn't need conversion
fn convert_if_necessary<'a>(
&'a self,
Expand Down
2 changes: 1 addition & 1 deletion components/datetime/src/any/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ where {

/// Converts a date to the correct calendar if necessary
///
/// Returns Err if the date is not ISO or compatible with the current calendar, returns Ok(None)
/// Returns `Err` if the date is not ISO or compatible with the current calendar, returns `Ok(None)`
/// if the date is compatible with the current calendar and doesn't need conversion
fn convert_if_necessary<'a>(
&'a self,
Expand Down
2 changes: 1 addition & 1 deletion components/datetime/src/any/zoned_datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ impl ZonedDateTimeFormatter {

/// Converts a date to the correct calendar if necessary
///
/// Returns Err if the date is not ISO or compatible with the current calendar, returns Ok(None)
/// Returns `Err` if the date is not ISO or compatible with the current calendar, returns `Ok(None)`
/// if the date is compatible with the current calendar and doesn't need conversion
fn convert_if_necessary(
&self,
Expand Down
6 changes: 3 additions & 3 deletions components/datetime/src/options/length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl Default for Bag {
}

impl Bag {
/// Constructs a Bag with all fields set to None
/// Constructs a `Bag` with all fields set to `None`.
///
/// Note that the [`Default`] implementation returns medium date and time options
pub fn empty() -> Self {
Expand All @@ -113,15 +113,15 @@ impl Bag {
}
}

/// Constructs a Bag given a date field (time set to None)
/// Constructs a `Bag` given a `date` field (`time` set to `None`)
pub fn from_date_style(date: Date) -> Self {
Self {
date: Some(date),
time: None,
}
}

/// Constructs a Bag given a time field (date set to None)
/// Constructs a `Bag` given a `time` field (`date` set to `None`)
pub fn from_time_style(time: Time) -> Self {
Self {
date: None,
Expand Down
2 changes: 1 addition & 1 deletion components/properties/src/provider/names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl PartialOrd for NormalizedPropertyNameStr {
}

/// Normalize a character based on the "loose matching" described in PropertyValueAliases.txt,
/// returning None for skippable characters
/// returning `None` for skippable characters
///
/// ICU has [code for this][1] (and [during property lookup][2]) which we emulate.
/// In particular, ICU only does normalization within ASCII, which makes sense since character names
Expand Down
2 changes: 1 addition & 1 deletion docs/design/data_safety.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl MonthNamesBad {
pub fn get_first_month_name(&self) -> &str {
&self.month_names[0]
}
/// Returns None only if `idx` is greater than the month count.
/// Returns `None`` only if `idx` is greater than the month count.
pub fn get_month_name_at_index(&self, idx: usize) -> Option<&str> {
if idx >= self.month_count {
return None;
Expand Down
2 changes: 1 addition & 1 deletion experimental/zerotrie/src/builder/nonconst/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub trait TrieBuilderStore {
/// Swap the adjacent ranges `self[start..mid]` and `self[mid..limit]`.
fn atbs_swap_ranges(&mut self, start: usize, mid: usize, limit: usize);

/// Remove and return the first element in the store, or None if empty.
/// Remove and return the first element in the store, or `None` if empty.
fn atbs_pop_front(&mut self) -> Option<u8>;

/// Prepend `n` zeros to the front of the store.
Expand Down
2 changes: 1 addition & 1 deletion ffi/diplomat/cpp/docs/source/bidi_ffi.rst

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ffi/diplomat/cpp/include/ICU4XBidiInfo.hpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ffi/diplomat/js/docs/source/bidi_ffi.rst

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ffi/diplomat/js/include/ICU4XBidiInfo.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ffi/diplomat/src/bidi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ pub mod ffi {
self.0.paragraphs.len()
}

/// Get the nth paragraph, returning None if out of bounds
/// Get the nth paragraph, returning `None` if out of bounds
pub fn paragraph_at(&'text self, n: usize) -> Option<Box<ICU4XBidiParagraph<'text>>> {
self.0
.paragraphs
Expand Down
2 changes: 1 addition & 1 deletion ffi/freertos/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use std::env;

/// Returns whether the Rust compiler needs an `#[alloc_error_handler]`
/// set. Returns None for cases where we cannot determine the nightly version of the
/// set. Returns `None` for cases where we cannot determine the nightly version of the
/// compiler.
fn needs_alloc_error_handler() -> Option<bool> {
use rustc_version::Channel;
Expand Down
2 changes: 1 addition & 1 deletion provider/core/src/any.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ pub struct AnyResponse {
/// Metadata about the returned object.
pub metadata: DataResponseMetadata,

/// The object itself; None if it was not loaded.
/// The object itself; `None` if it was not loaded.
pub payload: Option<AnyPayload>,
}

Expand Down
2 changes: 1 addition & 1 deletion provider/core/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ where
/// Metadata about the returned object.
pub metadata: DataResponseMetadata,

/// The object itself; None if it was not loaded.
/// The object itself; `None` if it was not loaded.
pub payload: Option<DataPayload<M>>,
}

Expand Down
4 changes: 2 additions & 2 deletions provider/datagen/src/transform/cldr/datetime/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ macro_rules! symbols_from {
};
([$symbols: path, $name2: ident], $ctx:ty) => {
impl $symbols {
// Helper function which returns None if the two groups of symbols overlap.
// Helper function which returns `None` if the two groups of symbols overlap.
pub fn get_unaliased(&self, other: &Self) -> Option<Self> {
if self == other {
None
Expand All @@ -195,7 +195,7 @@ macro_rules! symbols_from {
}

impl ca::StandAloneWidths<$symbols> {
// Helper function which returns None if the two groups of symbols overlap.
// Helper function which returns `None` if the two groups of symbols overlap.
pub fn get_unaliased(&self, other: &ca::FormatWidths<$symbols>) -> Option<Self> {
let abbreviated = self.abbreviated.as_ref().and_then(|v| v.get_unaliased(&other.abbreviated));
let narrow = self.narrow.as_ref().and_then(|v| v.get_unaliased(&other.narrow));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct ParsedPattern {
/// The unescaped literal text, e.g., " mille" for the pattern "00 mille",
/// "mille" for the pattern "mille".
pub literal_text: Cow<'static, str>,
/// The placeholder; None for patterns such as "mille".
/// The placeholder; `None` for patterns such as "mille".
pub placeholder: Option<ParsedPlaceholder>,
}

Expand Down
17 changes: 9 additions & 8 deletions utils/calendrical_calculations/src/astronomy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ impl Astronomical {
signum(equation) * libm::fabs(equation).min(12.0 / 24.0)
}

/// The standard time of dusk at a given location on a given date, or None if there is no
/// The standard time of dusk at a given location on a given date, or `None` if there is no
/// dusk on that date.
///
/// Based on functions from _Calendrical Calculations_ by Reingold & Dershowitz.
Expand Down Expand Up @@ -418,7 +418,7 @@ impl Astronomical {
/// Approx moment in local time near `moment` at which the depression angle of the sun is `alpha` (negative if
/// the sun is above the horizon) at the given location; since the same angle of depression of the sun
/// can exist twice in a day, early is set to true to specify the morning moment, and false for the
/// evening. Returns None if the specified angle is not reached.
/// evening. Returns `None` if the specified angle is not reached.
///
/// Based on functions from _Calendrical Calculations_ by Reingold & Dershowitz.
/// Reference lisp code: <https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3607-L3631>
Expand Down Expand Up @@ -468,7 +468,7 @@ impl Astronomical {
/// Moment in local time near `approx` at which the depression angle of the sun is `alpha` (negative if
/// the sun is above the horizon) at the given location; since the same angle of depression of the sun
/// can exist twice in a day, early is set to true to specify the morning moment, and false for the
/// evening. Returns None if the specified angle is not reached.
/// evening. Returns `None` if the specified angle is not reached.
///
/// Based on functions from _Calendrical Calculations_ by Reingold & Dershowitz.
/// Reference lisp code: <https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3633-L3647>
Expand Down Expand Up @@ -1459,7 +1459,7 @@ impl Astronomical {
}

/// Standard time of moonset on the date of the given moment and at the given location.
/// Returns None if there is no such moonset.
/// Returns `None` if there is no such moonset.
///
/// Based on functions from _Calendrical Calculations_ by Reingold & Dershowitz.
/// Lisp code reference: <https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L4655-L4681>
Expand Down Expand Up @@ -1504,7 +1504,8 @@ impl Astronomical {
}

/// Standard time of sunset on the date of the given moment and at the given location.
/// Returns None if there is no such sunset.
/// Returns `None` if there is no such sunset.
///
/// Based on functions from _Calendrical Calculations_ by Reingold & Dershowitz.
/// Lisp code reference: <https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L3700-L3706>
#[allow(dead_code)]
Expand All @@ -1514,7 +1515,7 @@ impl Astronomical {
}

/// Time between sunset and moonset on the date of the given moment at the given location.
/// Returns None if there is no such sunset.
/// Returns `None` if there is no such sunset.
///
/// Based on functions from _Calendrical Calculations_ by Reingold & Dershowitz.
/// Lisp code reference: <https://github.com/EdReingold/calendar-code2/blob/9afc1f3/calendar.l#L6770-L6778>
Expand Down Expand Up @@ -1842,7 +1843,7 @@ impl Astronomical {
Self::shaukat_criterion(date, location)
}

/// Given an angle and a Moment moment, approximate the Moment at or before moment
/// Given an `angle` and a [`Moment`] `moment`, approximate the `Moment` at or before moment
/// at which solar longitude exceeded the given angle.
///
/// Based on functions from _Calendrical Calculations_ by Reingold & Dershowitz.
Expand Down Expand Up @@ -1897,7 +1898,7 @@ impl Astronomical {
}

/// Function to find the number of the new moon at or after a given moment;
/// helper function for new_moon_before and new_moon_at_or_after
/// helper function for `new_moon_before` and `new_moon_at_or_after`.
///
/// Based on functions from _Calendrical Calculations_ by Reingold & Dershowitz.
/// This function incorporates code from the book/lisp equivalent functions
Expand Down
Loading
Loading