From d55ec1b4c1a8313b00f1abd95beaf10a9a5bc1a9 Mon Sep 17 00:00:00 2001 From: Nick Hackman Date: Sun, 18 Aug 2019 21:07:23 -0400 Subject: Fixed Clippy warning of long return type Created an alias named TablePair being a (Cow<'a, str>, Value<'a>) --- src/de.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/de.rs b/src/de.rs index 69331ab..4c3acc5 100644 --- a/src/de.rs +++ b/src/de.rs @@ -20,6 +20,9 @@ use crate::datetime; use crate::spanned; use crate::tokens::{Error as TokenError, Span, Token, Tokenizer}; +/// Type Alias for a TOML Table pair +type TablePair<'a> = (Cow<'a, str>, Value<'a>); + /// Deserializes a byte slice into a type. /// /// This function will attempt to interpret `bytes` as UTF-8 data and then @@ -292,14 +295,14 @@ impl<'de, 'b> de::Deserializer<'de> for &'b mut Deserializer<'de> { struct Table<'a> { at: usize, header: Vec>, - values: Option, Value<'a>)>>, + values: Option>>, array: bool, } #[doc(hidden)] pub struct MapVisitor<'de, 'b> { - values: vec::IntoIter<(Cow<'de, str>, Value<'de>)>, - next_value: Option<(Cow<'de, str>, Value<'de>)>, + values: vec::IntoIter>, + next_value: Option>, depth: usize, cur: usize, cur_parent: usize, @@ -855,7 +858,7 @@ impl<'de> de::EnumAccess<'de> for DottedTableDeserializer<'de> { } struct InlineTableDeserializer<'a> { - values: vec::IntoIter<(Cow<'a, str>, Value<'a>)>, + values: vec::IntoIter>, next_value: Option>, } @@ -1539,7 +1542,7 @@ impl<'a> Deserializer<'a> { // TODO(#140): shouldn't buffer up this entire table in memory, it'd be // great to defer parsing everything until later. - fn inline_table(&mut self) -> Result<(Span, Vec<(Cow<'a, str>, Value<'a>)>), Error> { + fn inline_table(&mut self) -> Result<(Span, Vec>), Error> { let mut ret = Vec::new(); self.eat_whitespace()?; if let Some(span) = self.eat_spanned(Token::RightBrace)? { @@ -1635,7 +1638,7 @@ impl<'a> Deserializer<'a> { &self, mut key_parts: Vec>, value: Value<'a>, - values: &mut Vec<(Cow<'a, str>, Value<'a>)>, + values: &mut Vec>, ) -> Result<(), Error> { let key = key_parts.remove(0); if key_parts.is_empty() { @@ -2026,8 +2029,8 @@ enum E<'a> { String(Cow<'a, str>), Datetime(&'a str), Array(Vec>), - InlineTable(Vec<(Cow<'a, str>, Value<'a>)>), - DottedTable(Vec<(Cow<'a, str>, Value<'a>)>), + InlineTable(Vec>), + DottedTable(Vec>), } impl<'a> E<'a> { -- cgit v1.2.3