From 8f13fc9689af200b2bd04ba6ea15a1bc1fe29090 Mon Sep 17 00:00:00 2001 From: Tiaan Louw Date: Mon, 8 Apr 2024 00:04:27 +0200 Subject: [PATCH] Further clarifications in docs for what errors are returned. (#380) Based on #281 --- src/nth.rs | 2 +- src/parser.rs | 2 +- src/rules_and_declarations.rs | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/nth.rs b/src/nth.rs index e4bde0de..4fe5a6bc 100644 --- a/src/nth.rs +++ b/src/nth.rs @@ -7,7 +7,7 @@ use super::{BasicParseError, Parser, ParserInput, Token}; /// Parse the *An+B* notation, as found in the `:nth-child()` selector. /// The input is typically the arguments of a function, /// in which case the caller needs to check if the arguments’ parser is exhausted. -/// Return `Ok((A, B))`, or `Err(())` for a syntax error. +/// Return `Ok((A, B))`, or an `Err(..)` for a syntax error. pub fn parse_nth<'i>(input: &mut Parser<'i, '_>) -> Result<(i32, i32), BasicParseError<'i>> { match *input.next()? { Token::Number { diff --git a/src/parser.rs b/src/parser.rs index b1357f26..77a21008 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -698,7 +698,7 @@ impl<'i: 't, 't> Parser<'i, 't> { /// /// Successful results are accumulated in a vector. /// - /// This method returns `Err(())` the first time that a closure call does, + /// This method returns an`Err(..)` the first time that a closure call does, /// or if a closure call leaves some input before the next comma or the end /// of the input. #[inline] diff --git a/src/rules_and_declarations.rs b/src/rules_and_declarations.rs index b23e9dc0..c6af2311 100644 --- a/src/rules_and_declarations.rs +++ b/src/rules_and_declarations.rs @@ -34,7 +34,7 @@ pub trait DeclarationParser<'i> { /// /// Return the finished representation for the declaration /// as returned by `DeclarationListParser::next`, - /// or `Err(())` to ignore the entire declaration as invalid. + /// or an `Err(..)` to ignore the entire declaration as invalid. /// /// Declaration name matching should be case-insensitive in the ASCII range. /// This can be done with `std::ascii::Ascii::eq_ignore_ascii_case`, @@ -78,7 +78,7 @@ pub trait AtRuleParser<'i> { /// Parse the prelude of an at-rule with the given `name`. /// /// Return the representation of the prelude and the type of at-rule, - /// or `Err(())` to ignore the entire at-rule as invalid. + /// or an `Err(..)` to ignore the entire at-rule as invalid. /// /// The prelude is the part after the at-keyword /// and before the `;` semicolon or `{ /* ... */ }` block. @@ -122,7 +122,7 @@ pub trait AtRuleParser<'i> { /// /// Return the finished representation of the at-rule /// as returned by `RuleListParser::next` or `DeclarationListParser::next`, - /// or `Err(())` to ignore the entire at-rule as invalid. + /// or an `Err(..)` to ignore the entire at-rule as invalid. /// /// This is only called when `parse_prelude` returned `WithBlock`, and a block /// was indeed found following the prelude. @@ -161,7 +161,7 @@ pub trait QualifiedRuleParser<'i> { /// Parse the prelude of a qualified rule. For style rules, this is as Selector list. /// /// Return the representation of the prelude, - /// or `Err(())` to ignore the entire at-rule as invalid. + /// or an `Err(..)` to ignore the entire at-rule as invalid. /// /// The prelude is the part before the `{ /* ... */ }` block. /// @@ -180,7 +180,7 @@ pub trait QualifiedRuleParser<'i> { /// /// Return the finished representation of the qualified rule /// as returned by `RuleListParser::next`, - /// or `Err(())` to ignore the entire at-rule as invalid. + /// or an `Err(..)` to ignore the entire at-rule as invalid. fn parse_block<'t>( &mut self, prelude: Self::Prelude, @@ -353,7 +353,7 @@ where } } -/// `RuleListParser` is an iterator that yields `Ok(_)` for a rule or `Err(())` for an invalid one. +/// `RuleListParser` is an iterator that yields `Ok(_)` for a rule or an `Err(..)` for an invalid one. impl<'i, 't, 'a, R, P, E: 'i> Iterator for StyleSheetParser<'i, 't, 'a, P> where P: QualifiedRuleParser<'i, QualifiedRule = R, Error = E>