Enable the missing-errors-doc clippy checks
This commit is contained in:
parent
4c64feb5ad
commit
429813a0cd
5 changed files with 25 additions and 4 deletions
|
@ -168,6 +168,9 @@ impl<'a> YamlEmitter<'a> {
|
|||
self.multiline_strings
|
||||
}
|
||||
|
||||
/// Dump Yaml to an output stream.
|
||||
/// # Errors
|
||||
/// Returns `EmitError` when an error occurs.
|
||||
pub fn dump(&mut self, doc: &Yaml) -> EmitResult {
|
||||
// write DocumentStart
|
||||
writeln!(self.writer, "---")?;
|
||||
|
|
|
@ -31,10 +31,7 @@
|
|||
//! ```
|
||||
|
||||
#![cfg_attr(feature = "cargo-clippy", warn(clippy::pedantic))]
|
||||
#![cfg_attr(
|
||||
feature = "cargo-clippy",
|
||||
allow(clippy::should_implement_trait, clippy::missing_errors_doc,)
|
||||
)]
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(clippy::should_implement_trait))]
|
||||
|
||||
extern crate hashlink;
|
||||
|
||||
|
|
|
@ -218,6 +218,8 @@ impl<T: Iterator<Item = char>> Parser<T> {
|
|||
///
|
||||
/// Any subsequent call to [`Parser::peek`] will return the same value, until a call to
|
||||
/// [`Parser::next`] or [`Parser::load`].
|
||||
/// # Errors
|
||||
/// Returns `ScanError` when loading the next event fails.
|
||||
pub fn peek(&mut self) -> Result<&(Event, Marker), ScanError> {
|
||||
if let Some(ref x) = self.current {
|
||||
Ok(x)
|
||||
|
@ -228,6 +230,8 @@ impl<T: Iterator<Item = char>> Parser<T> {
|
|||
}
|
||||
|
||||
/// Try to load the next event and return it, consuming it from `self`.
|
||||
/// # Errors
|
||||
/// Returns `ScanError` when loading the next event fails.
|
||||
pub fn next(&mut self) -> ParseResult {
|
||||
match self.current.take() {
|
||||
None => self.parse(),
|
||||
|
@ -299,6 +303,8 @@ impl<T: Iterator<Item = char>> Parser<T> {
|
|||
///
|
||||
/// Note that any [`EventReceiver`] is also a [`MarkedEventReceiver`], so implementing the
|
||||
/// former is enough to call this function.
|
||||
/// # Errors
|
||||
/// Returns `ScanError` when loading fails.
|
||||
pub fn load<R: MarkedEventReceiver>(
|
||||
&mut self,
|
||||
recv: &mut R,
|
||||
|
|
|
@ -604,6 +604,9 @@ impl<T: Iterator<Item = char>> Scanner<T> {
|
|||
self.simple_key_allowed = false;
|
||||
}
|
||||
|
||||
/// Fetch the next token in the stream.
|
||||
/// # Errors
|
||||
/// Returns `ScanError` when the scanner does not find the next expected token.
|
||||
pub fn fetch_next_token(&mut self) -> ScanResult {
|
||||
self.lookahead(1);
|
||||
// eprintln!("--> fetch_next_token Cur {:?} {:?}", self.mark, self.ch());
|
||||
|
@ -708,6 +711,9 @@ impl<T: Iterator<Item = char>> Scanner<T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Return the next token in the stream.
|
||||
/// # Errors
|
||||
/// Returns `ScanError` when scanning fails to find an expected next token.
|
||||
pub fn next_token(&mut self) -> Result<Option<Token>, ScanError> {
|
||||
if self.stream_end_produced {
|
||||
return Ok(None);
|
||||
|
@ -731,6 +737,9 @@ impl<T: Iterator<Item = char>> Scanner<T> {
|
|||
Ok(Some(t))
|
||||
}
|
||||
|
||||
/// Fetch tokens from the token stream.
|
||||
/// # Errors
|
||||
/// Returns `ScanError` when loading fails.
|
||||
pub fn fetch_more_tokens(&mut self) -> ScanResult {
|
||||
let mut need_more;
|
||||
loop {
|
||||
|
|
|
@ -208,6 +208,8 @@ impl YamlLoader {
|
|||
/// The `source` is interpreted as YAML documents and is parsed. Parsing succeeds if and only
|
||||
/// if all documents are parsed successfully. An error in a latter document prevents the former
|
||||
/// from being returned.
|
||||
/// # Errors
|
||||
/// Returns `ScanError` when loading fails.
|
||||
pub fn load_from_str(source: &str) -> Result<Vec<Yaml>, ScanError> {
|
||||
Self::load_from_iter(source.chars())
|
||||
}
|
||||
|
@ -217,6 +219,8 @@ impl YamlLoader {
|
|||
/// The `source` is interpreted as YAML documents and is parsed. Parsing succeeds if and only
|
||||
/// if all documents are parsed successfully. An error in a latter document prevents the former
|
||||
/// from being returned.
|
||||
/// # Errors
|
||||
/// Returns `ScanError` when loading fails.
|
||||
pub fn load_from_iter<I: Iterator<Item = char>>(source: I) -> Result<Vec<Yaml>, ScanError> {
|
||||
let mut loader = YamlLoader::default();
|
||||
let mut parser = Parser::new(source);
|
||||
|
@ -259,6 +263,8 @@ impl<T: std::io::Read> YamlDecoder<T> {
|
|||
self
|
||||
}
|
||||
|
||||
/// # Errors
|
||||
/// Returns `LoadError` when decoding fails.
|
||||
pub fn decode(&mut self) -> Result<Vec<Yaml>, LoadError> {
|
||||
let mut buffer = Vec::new();
|
||||
self.source.read_to_end(&mut buffer)?;
|
||||
|
|
Loading…
Reference in a new issue