diff options
author | Jeff Vander Stoep <jeffv@google.com> | 2022-12-13 09:44:25 +0100 |
---|---|---|
committer | Jeff Vander Stoep <jeffv@google.com> | 2022-12-13 09:45:11 +0100 |
commit | 170479099bf8ae4f63477fa6cbb0479c31ee8c5d (patch) | |
tree | dace0417db08176725e451673b6c77327c27dee7 /src/iterators/pairs.rs | |
parent | 1abbfd62d0b8c9dd3aa8b9b29e983b87906d0a58 (diff) | |
download | pest-170479099bf8ae4f63477fa6cbb0479c31ee8c5d.tar.gz |
Upgrade pest to 2.5.1main-16k-with-phones
This project was upgraded with external_updater.
Usage: tools/external_updater/updater.sh update rust/crates/pest
For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md
Test: TreeHugger
Change-Id: I9ebbdf15c20a44c5d9ec77dd3ab916aae0ef2e5f
Diffstat (limited to 'src/iterators/pairs.rs')
-rw-r--r-- | src/iterators/pairs.rs | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/iterators/pairs.rs b/src/iterators/pairs.rs index abae123..e478ceb 100644 --- a/src/iterators/pairs.rs +++ b/src/iterators/pairs.rs @@ -7,11 +7,14 @@ // option. All files in the project carrying such notice may not be copied, // modified, or distributed except according to those terms. -use std::fmt; -use std::hash::{Hash, Hasher}; -use std::ptr; -use std::rc::Rc; -use std::str; +use alloc::format; +use alloc::rc::Rc; +use alloc::string::String; +use alloc::vec::Vec; +use core::fmt; +use core::hash::{Hash, Hasher}; +use core::ptr; +use core::str; #[cfg(feature = "pretty-print")] use serde::ser::SerializeStruct; @@ -20,7 +23,7 @@ use super::flat_pairs::{self, FlatPairs}; use super::pair::{self, Pair}; use super::queueable_token::QueueableToken; use super::tokens::{self, Tokens}; -use RuleType; +use crate::RuleType; /// An iterator over [`Pair`]s. It is created by [`pest::state`] and [`Pair::into_inner`]. /// @@ -40,7 +43,7 @@ pub fn new<R: RuleType>( input: &str, start: usize, end: usize, -) -> Pairs<R> { +) -> Pairs<'_, R> { Pairs { queue, input, @@ -243,13 +246,13 @@ impl<'i, R: RuleType> DoubleEndedIterator for Pairs<'i, R> { } impl<'i, R: RuleType> fmt::Debug for Pairs<'i, R> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_list().entries(self.clone()).finish() } } impl<'i, R: RuleType> fmt::Display for Pairs<'i, R> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "[{}]", @@ -302,6 +305,10 @@ impl<'i, R: RuleType> ::serde::Serialize for Pairs<'i, R> { mod tests { use super::super::super::macros::tests::*; use super::super::super::Parser; + use alloc::borrow::ToOwned; + use alloc::format; + use alloc::vec; + use alloc::vec::Vec; #[test] #[cfg(feature = "pretty-print")] |