tamer: Replace explicit array::IntoIter::new with IntoIter
Now that we're on 2021 Edition, the default behavior has changed to be consistent.main
parent
f9c9c95516
commit
772619f6f0
|
@ -74,10 +74,7 @@ mod attrs {
|
|||
fn empty_element_self_close_from_toks() {
|
||||
let name = ("ns", "elem").unwrap_into();
|
||||
|
||||
let toks = std::array::IntoIter::new([
|
||||
Token::Open(name, *S),
|
||||
Token::Close(None, *S2),
|
||||
]);
|
||||
let toks = [Token::Open(name, *S), Token::Close(None, *S2)].into_iter();
|
||||
|
||||
let expected = Element {
|
||||
name,
|
||||
|
@ -102,10 +99,8 @@ fn empty_element_self_close_from_toks() {
|
|||
fn empty_element_balanced_close_from_toks() {
|
||||
let name = ("ns", "openclose").unwrap_into();
|
||||
|
||||
let toks = std::array::IntoIter::new([
|
||||
Token::Open(name, *S),
|
||||
Token::Close(Some(name), *S2),
|
||||
]);
|
||||
let toks =
|
||||
[Token::Open(name, *S), Token::Close(Some(name), *S2)].into_iter();
|
||||
|
||||
let expected = Element {
|
||||
name,
|
||||
|
@ -131,10 +126,11 @@ fn empty_element_unbalanced_close_from_toks() {
|
|||
let open_name = "open".unwrap_into();
|
||||
let close_name = "unbalanced_name".unwrap_into();
|
||||
|
||||
let toks = std::array::IntoIter::new([
|
||||
let toks = [
|
||||
Token::Open(open_name, *S),
|
||||
Token::Close(Some(close_name), *S2),
|
||||
]);
|
||||
]
|
||||
.into_iter();
|
||||
|
||||
let mut sut = toks.scan(ParserState::new(), parse);
|
||||
|
||||
|
@ -161,7 +157,7 @@ fn empty_element_with_attrs_from_toks() {
|
|||
let val2b = AttrValue::Escaped("val2b".intern());
|
||||
let val2c = AttrValue::Escaped("val2b".intern());
|
||||
|
||||
let toks = std::array::IntoIter::new([
|
||||
let toks = [
|
||||
Token::Open(name, *S),
|
||||
Token::AttrName(attr1, *S),
|
||||
Token::AttrValue(val1, *S2),
|
||||
|
@ -171,7 +167,8 @@ fn empty_element_with_attrs_from_toks() {
|
|||
Token::AttrValueFragment(val2b, *S2),
|
||||
Token::AttrValue(val2c, *S3),
|
||||
Token::Close(None, *S2),
|
||||
]);
|
||||
]
|
||||
.into_iter();
|
||||
|
||||
let expected = Element {
|
||||
name,
|
||||
|
@ -209,14 +206,15 @@ fn element_with_empty_sibling_children() {
|
|||
let childa = "childa".unwrap_into();
|
||||
let childb = "childb".unwrap_into();
|
||||
|
||||
let toks = std::array::IntoIter::new([
|
||||
let toks = [
|
||||
Token::Open(parent, *S),
|
||||
Token::Open(childa, *S),
|
||||
Token::Close(None, *S2),
|
||||
Token::Open(childb, *S),
|
||||
Token::Close(None, *S2),
|
||||
Token::Close(Some(parent), *S2),
|
||||
]);
|
||||
]
|
||||
.into_iter();
|
||||
|
||||
let expected = Element {
|
||||
name: parent,
|
||||
|
@ -252,14 +250,15 @@ fn element_with_child_with_attributes() {
|
|||
let attr = "attr".unwrap_into();
|
||||
let value = AttrValue::Escaped("attr value".into());
|
||||
|
||||
let toks = std::array::IntoIter::new([
|
||||
let toks = [
|
||||
Token::Open(parent, *S),
|
||||
Token::Open(child, *S),
|
||||
Token::AttrName(attr, *S),
|
||||
Token::AttrValue(value, *S2),
|
||||
Token::Close(None, *S3),
|
||||
Token::Close(Some(parent), *S3),
|
||||
]);
|
||||
]
|
||||
.into_iter();
|
||||
|
||||
let expected = Element {
|
||||
name: parent,
|
||||
|
@ -285,12 +284,13 @@ fn parser_from_filters_incomplete() {
|
|||
let attr = "a".unwrap_into();
|
||||
let val = AttrValue::Escaped("val1".intern());
|
||||
|
||||
let toks = std::array::IntoIter::new([
|
||||
let toks = [
|
||||
Token::Open(name, *S),
|
||||
Token::AttrName(attr, *S),
|
||||
Token::AttrValue(val, *S2),
|
||||
Token::Close(None, *S2),
|
||||
]);
|
||||
]
|
||||
.into_iter();
|
||||
|
||||
let expected = Element {
|
||||
name,
|
||||
|
|
|
@ -66,7 +66,7 @@ fn header(pkg_name: SymbolId, relroot: SymbolId) -> HeaderIter {
|
|||
// editions regarding arrays and [`IntoIter`]. This was written in
|
||||
// edition 2018; 2021 will be out in a few months at the time of
|
||||
// writing.
|
||||
array::IntoIter::new([
|
||||
[
|
||||
Token::Open(QN_PACKAGE, LSPAN),
|
||||
Token::AttrName(QN_XMLNS, LSPAN),
|
||||
Token::AttrValue(AttrValue::st_uri(URI_LV_RATER), LSPAN),
|
||||
|
@ -83,7 +83,8 @@ fn header(pkg_name: SymbolId, relroot: SymbolId) -> HeaderIter {
|
|||
Token::AttrName(QN_UUROOTPATH, LSPAN),
|
||||
Token::AttrValue(AttrValue::Escaped(relroot), LSPAN),
|
||||
Token::Open(QN_L_DEP, LSPAN),
|
||||
])
|
||||
]
|
||||
.into_iter()
|
||||
}
|
||||
|
||||
const DEP_MAX_ATTRS: usize = 9;
|
||||
|
@ -239,10 +240,11 @@ type FooterIter = array::IntoIter<Token, FOOTER_SIZE>;
|
|||
|
||||
#[inline]
|
||||
fn footer() -> FooterIter {
|
||||
array::IntoIter::new([
|
||||
[
|
||||
Token::Close(Some(QN_L_DEP), LSPAN),
|
||||
Token::Close(Some(QN_PACKAGE), LSPAN),
|
||||
])
|
||||
]
|
||||
.into_iter()
|
||||
}
|
||||
|
||||
/// Iterator that lazily lowers `xmle` object files into Xir.
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
|
||||
use super::{Interner, SymbolId, SymbolIndexSize};
|
||||
use crate::global;
|
||||
use std::array;
|
||||
|
||||
/// Static symbol identifier that is stable between runs of the same version
|
||||
/// of TAMER.
|
||||
|
@ -260,11 +259,11 @@ macro_rules! static_symbols {
|
|||
// require that we count the number of items first for the
|
||||
// sake of the type definition.
|
||||
// This is more convenient.
|
||||
array::IntoIter::new([
|
||||
[
|
||||
$(
|
||||
$str,
|
||||
)*
|
||||
]).for_each(|sym| { interner.intern(sym); });
|
||||
].into_iter().for_each(|sym| { interner.intern(sym); });
|
||||
|
||||
interner
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue