tamer: asg::air: Remove unncessary vec![] usage in tests
This has been bothering me for quite a long time, and is just more test cleanup before I introduce more. I suspect this came from habit with the previous Rust edition where `into_iter()` on arrays was a much more verbose operation. To be clear: this change isn't for performance. It's about not doing something silly when it's unnecessary, which also sets a bad example for others. There are many other tests in other modules that will need updating at some point. DEV-13163main
parent
2e33e9e93e
commit
8a10f8bbbe
|
@ -50,7 +50,7 @@ fn expr_empty_ident() {
|
|||
let id = SPair("foo".into(), S2);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
ExprStart(ExprOp::Sum, S1),
|
||||
BindIdent(id),
|
||||
ExprEnd(S3),
|
||||
|
@ -66,7 +66,7 @@ fn expr_empty_ident() {
|
|||
|
||||
#[test]
|
||||
fn expr_without_pkg() {
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
// No package
|
||||
// (because we're not parsing with `parse_as_pkg_body` below)
|
||||
ExprStart(ExprOp::Sum, S1),
|
||||
|
@ -92,7 +92,7 @@ fn close_pkg_mid_expr() {
|
|||
let id = SPair("foo".into(), S4);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
PkgStart(S1, SPair("/pkg".into(), S1)),
|
||||
ExprStart(ExprOp::Sum, S2),
|
||||
PkgEnd(S3),
|
||||
|
@ -129,7 +129,7 @@ fn open_pkg_mid_expr() {
|
|||
let id = SPair("foo".into(), S4);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
PkgStart(S1, pkg_a),
|
||||
ExprStart(ExprOp::Sum, S2),
|
||||
PkgStart(S3, pkg_nested),
|
||||
|
@ -168,7 +168,7 @@ fn expr_non_empty_ident_root() {
|
|||
let id_b = SPair("bar".into(), S2);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
ExprStart(ExprOp::Sum, S1),
|
||||
// Identifier while still empty...
|
||||
BindIdent(id_a),
|
||||
|
@ -201,7 +201,7 @@ fn expr_non_empty_bind_only_after() {
|
|||
let id = SPair("foo".into(), S2);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
ExprStart(ExprOp::Sum, S1),
|
||||
// Expression root is still dangling at this point.
|
||||
ExprStart(ExprOp::Sum, S2),
|
||||
|
@ -226,7 +226,7 @@ fn expr_non_empty_bind_only_after() {
|
|||
// since they're either mistakes or misconceptions.
|
||||
#[test]
|
||||
fn expr_dangling_no_subexpr() {
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
ExprStart(ExprOp::Sum, S1),
|
||||
// No `BindIdent`,
|
||||
// so this expression is dangling.
|
||||
|
@ -252,7 +252,7 @@ fn expr_dangling_no_subexpr() {
|
|||
#[test]
|
||||
fn expr_dangling_with_subexpr() {
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
ExprStart(ExprOp::Sum, S1),
|
||||
// Expression root is still dangling at this point.
|
||||
ExprStart(ExprOp::Sum, S2),
|
||||
|
@ -284,7 +284,7 @@ fn expr_dangling_with_subexpr_ident() {
|
|||
let id = SPair("foo".into(), S3);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
ExprStart(ExprOp::Sum, S1),
|
||||
// Expression root is still dangling at this point.
|
||||
ExprStart(ExprOp::Sum, S2),
|
||||
|
@ -327,7 +327,7 @@ fn expr_reachable_subsequent_dangling() {
|
|||
let id = SPair("foo".into(), S2);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
// Reachable
|
||||
ExprStart(ExprOp::Sum, S1),
|
||||
BindIdent(id),
|
||||
|
@ -366,7 +366,7 @@ fn recovery_expr_reachable_after_dangling() {
|
|||
let id = SPair("foo".into(), S4);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
// Dangling
|
||||
ExprStart(ExprOp::Sum, S1),
|
||||
ExprEnd(S2),
|
||||
|
@ -419,7 +419,7 @@ fn expr_close_unbalanced() {
|
|||
let id = SPair("foo".into(), S3);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
// Close before _any_ open.
|
||||
ExprEnd(S1),
|
||||
|
||||
|
@ -471,7 +471,7 @@ fn sibling_subexprs_have_ordered_edges_to_parent() {
|
|||
let id_root = SPair("root".into(), S1);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
ExprStart(ExprOp::Sum, S1),
|
||||
// Identify the root so that it is not dangling.
|
||||
BindIdent(id_root),
|
||||
|
@ -521,7 +521,7 @@ fn nested_subexprs_related_to_relative_parent() {
|
|||
let id_suba = SPair("suba".into(), S2);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
ExprStart(ExprOp::Sum, S1), // 0
|
||||
BindIdent(id_root),
|
||||
|
||||
|
@ -561,7 +561,7 @@ fn expr_redefine_ident() {
|
|||
let id_dup = SPair("foo".into(), S3);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
ExprStart(ExprOp::Sum, S1),
|
||||
BindIdent(id_first),
|
||||
|
||||
|
@ -613,7 +613,7 @@ fn expr_still_dangling_on_redefine() {
|
|||
let id_second = SPair("bar".into(), S9);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
// First expr (OK)
|
||||
ExprStart(ExprOp::Sum, S1),
|
||||
BindIdent(id_first),
|
||||
|
@ -696,7 +696,7 @@ fn expr_ref_to_ident() {
|
|||
let id_bar = SPair("bar".into(), S6);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
ExprStart(ExprOp::Sum, S1),
|
||||
BindIdent(id_foo),
|
||||
|
||||
|
@ -755,7 +755,7 @@ fn idents_share_defining_pkg() {
|
|||
|
||||
// An expression nested within another.
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
PkgStart(S1, SPair("/pkg".into(), S1)),
|
||||
ExprStart(ExprOp::Sum, S2),
|
||||
BindIdent(id_foo),
|
||||
|
@ -794,7 +794,7 @@ fn expr_doc_short_desc() {
|
|||
let clause = SPair("short desc".into(), S3);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
ExprStart(ExprOp::Sum, S1),
|
||||
BindIdent(id_expr),
|
||||
DocIndepClause(clause),
|
||||
|
@ -827,7 +827,7 @@ fn abstract_bind_without_dangling_container() {
|
|||
let id_ok = SPair("concrete".into(), S5);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
ExprStart(ExprOp::Sum, S1),
|
||||
// This expression is bound to an _abstract_ identifier,
|
||||
// which will be expanded at a later time.
|
||||
|
|
|
@ -47,7 +47,7 @@ fn ident_decl() {
|
|||
};
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
PkgStart(S1, SPair("/pkg".into(), S1)),
|
||||
IdentDecl(id, kind.clone(), src.clone()),
|
||||
// Attempt re-declaration.
|
||||
|
@ -98,7 +98,7 @@ fn ident_extern_decl() {
|
|||
};
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
PkgStart(S1, SPair("/pkg".into(), S1)),
|
||||
IdentExternDecl(id, kind.clone(), src.clone()),
|
||||
// Redeclare with a different kind
|
||||
|
@ -145,7 +145,7 @@ fn ident_dep() {
|
|||
let dep = SPair("dep".into(), S3);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
PkgStart(S1, SPair("/pkg".into(), S1)),
|
||||
IdentDep(id, dep),
|
||||
PkgEnd(S4),
|
||||
|
@ -183,7 +183,7 @@ fn ident_fragment() {
|
|||
let frag = "fragment text".into();
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
PkgStart(S1, SPair("/pkg".into(), S1)),
|
||||
// Identifier must be declared before it can be given a
|
||||
// fragment.
|
||||
|
@ -235,7 +235,7 @@ fn ident_root_missing() {
|
|||
let id = SPair("toroot".into(), S2);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
PkgStart(S1, SPair("/pkg".into(), S1)),
|
||||
IdentRoot(id),
|
||||
PkgEnd(S3),
|
||||
|
@ -281,7 +281,7 @@ fn ident_root_existing() {
|
|||
assert!(!kind.is_auto_root());
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
PkgStart(S1, SPair("/pkg".into(), S1)),
|
||||
IdentDecl(id, kind.clone(), src.clone()),
|
||||
IdentRoot(SPair(id.symbol(), S3)),
|
||||
|
@ -372,7 +372,7 @@ fn declare_kind_auto_root() {
|
|||
#[test]
|
||||
fn pkg_is_rooted() {
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
PkgStart(S1, SPair("/pkg".into(), S1)),
|
||||
PkgEnd(S2),
|
||||
];
|
||||
|
@ -394,7 +394,7 @@ fn pkg_is_rooted() {
|
|||
|
||||
#[test]
|
||||
fn close_pkg_without_open() {
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
PkgEnd(S1),
|
||||
// RECOVERY: Try again.
|
||||
PkgStart(S2, SPair("/pkg".into(), S2)),
|
||||
|
@ -418,7 +418,7 @@ fn nested_open_pkg() {
|
|||
let name_b = SPair("/pkg-b".into(), S4);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
PkgStart(S1, name_a),
|
||||
// Cannot nest package
|
||||
PkgStart(S3, name_b),
|
||||
|
@ -445,7 +445,7 @@ fn pkg_canonical_name() {
|
|||
let name = SPair("/foo/bar".into(), S2);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
PkgStart(S1, name),
|
||||
PkgEnd(S3),
|
||||
];
|
||||
|
@ -482,7 +482,7 @@ fn pkg_cannot_redeclare() {
|
|||
let namefix = SPair("/foo/fix".into(), S7);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
PkgStart(S1, name),
|
||||
PkgEnd(S3),
|
||||
|
||||
|
@ -531,7 +531,7 @@ fn pkg_import_canonicalized_against_current_pkg() {
|
|||
let pkg_rel = SPair("baz/quux".into(), S3);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
PkgStart(S1, pkg_name),
|
||||
PkgImport(pkg_rel),
|
||||
PkgEnd(S3),
|
||||
|
@ -564,7 +564,7 @@ fn pkg_doc() {
|
|||
let doc_b = SPair("first".into(), S4);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
DocText(doc_a),
|
||||
|
||||
// Some object to place in-between the two
|
||||
|
@ -606,7 +606,7 @@ fn resume_previous_parsing_context() {
|
|||
// We're going to test with opaque objects as if we are the linker.
|
||||
// This is the first parse.
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
// The first package will reference an identifier from another
|
||||
// package.
|
||||
PkgStart(S1, SPair("/pkg-a".into(), S1)),
|
||||
|
@ -620,7 +620,7 @@ fn resume_previous_parsing_context() {
|
|||
// This is the token stream for the second parser,
|
||||
// which will re-use the above context.
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
// This package will define that identifier,
|
||||
// which should also find the identifier having been placed into
|
||||
// the global environment.
|
||||
|
|
|
@ -39,7 +39,7 @@ fn tpl_defining_pkg() {
|
|||
let id_tpl = SPair("_tpl_".into(), S3);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
PkgStart(S1, SPair("/pkg".into(), S1)),
|
||||
// This also tests tpl as a transition away from the package header.
|
||||
TplStart(S2),
|
||||
|
@ -67,7 +67,7 @@ fn tpl_after_expr() {
|
|||
let id_tpl = SPair("_tpl_".into(), S6);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
PkgStart(S1, SPair("/pkg".into(), S1)),
|
||||
// This expression is incidental to this test;
|
||||
// it need only parse.
|
||||
|
@ -104,7 +104,7 @@ fn tpl_within_expr() {
|
|||
let id_tpl = SPair("_tpl_".into(), S7);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
PkgStart(S1, SPair("/pkg".into(), S1)),
|
||||
ExprStart(ExprOp::Sum, S2),
|
||||
BindIdent(id_expr),
|
||||
|
@ -164,7 +164,7 @@ fn tpl_apply_within_expr() {
|
|||
let ref_tpl = SPair("_tpl_".into(), S8);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
ExprStart(ExprOp::Sum, S2),
|
||||
BindIdent(id_expr),
|
||||
|
||||
|
@ -211,7 +211,7 @@ fn close_tpl_without_open() {
|
|||
let id_tpl = SPair("_tpl_".into(), S3);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
TplEnd(S1),
|
||||
// RECOVERY: Try again.
|
||||
TplStart(S2),
|
||||
|
@ -241,7 +241,7 @@ fn tpl_with_reachable_expression() {
|
|||
let id_expr_b = SPair("exprb".into(), S7);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
TplStart(S1),
|
||||
BindIdent(id_tpl),
|
||||
|
||||
|
@ -314,7 +314,7 @@ fn tpl_holds_dangling_expressions() {
|
|||
let id_tpl = SPair("_tpl_".into(), S2);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
TplStart(S1),
|
||||
BindIdent(id_tpl),
|
||||
|
||||
|
@ -349,7 +349,7 @@ fn close_tpl_mid_open() {
|
|||
let id_expr = SPair("expr".into(), S4);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
TplStart(S1),
|
||||
BindIdent(id_tpl),
|
||||
|
||||
|
@ -396,7 +396,7 @@ fn unreachable_anonymous_tpl() {
|
|||
let id_ok = SPair("_tpl_".into(), S4);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
TplStart(S1),
|
||||
// No BindIdent
|
||||
TplEnd(S2),
|
||||
|
@ -440,7 +440,7 @@ fn unreachable_anonymous_tpl() {
|
|||
#[test]
|
||||
fn anonymous_tpl_immediate_ref() {
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
TplStart(S1),
|
||||
// No BindIdent
|
||||
// But ended with `TplEndRef`,
|
||||
|
@ -465,7 +465,7 @@ fn tpl_with_param() {
|
|||
let param_desc = SPair("param desc".into(), S9);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
TplStart(S1),
|
||||
BindIdent(id_tpl),
|
||||
|
||||
|
@ -576,7 +576,7 @@ fn tpl_apply_nested() {
|
|||
let id_tpl_outer = SPair("_tpl-outer_".into(), S2);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
TplStart(S1),
|
||||
BindIdent(id_tpl_outer),
|
||||
|
||||
|
@ -614,7 +614,7 @@ fn tpl_apply_nested_missing() {
|
|||
let ref_tpl_inner_post = SPair(tpl_inner, S10);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
TplStart(S1),
|
||||
BindIdent(id_tpl_outer),
|
||||
|
||||
|
@ -682,7 +682,7 @@ fn tpl_doc_short_desc() {
|
|||
let clause = SPair("short desc".into(), S3);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
TplStart(S1),
|
||||
BindIdent(id_tpl),
|
||||
DocIndepClause(clause),
|
||||
|
@ -725,7 +725,7 @@ fn metavars_within_exprs_hoisted_to_parent_tpl() {
|
|||
let id_param_inner = SPair("@param_inner@".into(), S12);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
TplStart(S1),
|
||||
BindIdent(id_tpl_outer),
|
||||
|
||||
|
@ -792,7 +792,7 @@ fn expr_abstract_bind_produces_cross_edge_from_ident_to_meta() {
|
|||
let id_meta = SPair("@foo@".into(), S4);
|
||||
|
||||
#[rustfmt::skip]
|
||||
let toks = vec![
|
||||
let toks = [
|
||||
TplStart(S1),
|
||||
// This identifier is concrete;
|
||||
// the abstract identifier will be the _expression_.
|
||||
|
|
Loading…
Reference in New Issue