Reject empty pattern in `assert_.._matches`.
PiperOrigin-RevId: 521471750
diff --git a/rs_bindings_from_cc/ir_matchers.rs b/rs_bindings_from_cc/ir_matchers.rs
index 4202ee7..423ddf2 100644
--- a/rs_bindings_from_cc/ir_matchers.rs
+++ b/rs_bindings_from_cc/ir_matchers.rs
@@ -134,8 +134,8 @@
#[test]
fn test_optional_trailing_comma() {
- assert_ir_matches!(ir_from_cc("").unwrap(), quote! {});
- assert_ir_matches!(ir_from_cc("").unwrap(), quote! {},);
+ assert_ir_matches!(ir_from_cc("").unwrap(), quote! { FlatIR { ... }});
+ assert_ir_matches!(ir_from_cc("").unwrap(), quote! { FlatIR { ... }},);
assert_ir_not_matches!(ir_from_cc("").unwrap(), quote! {this pattern is not in the ir});
assert_ir_not_matches!(ir_from_cc("").unwrap(), quote! {this pattern is not in the ir},);
diff --git a/rs_bindings_from_cc/src_code_gen.rs b/rs_bindings_from_cc/src_code_gen.rs
index 6d0ad0b..235d145 100644
--- a/rs_bindings_from_cc/src_code_gen.rs
+++ b/rs_bindings_from_cc/src_code_gen.rs
@@ -7245,9 +7245,9 @@
#[test]
fn test_format_generic_params() -> Result<()> {
- assert_rs_matches!(
- format_generic_params(/* lifetimes= */ &[], std::iter::empty::<syn::Ident>()),
- quote! {}
+ assert!(
+ format_generic_params(/* lifetimes= */ &[], std::iter::empty::<syn::Ident>())
+ .is_empty(),
);
let idents = ["T1", "T2"].iter().map(|s| make_rs_ident(s));
@@ -8778,7 +8778,7 @@
#[test]
fn test_generate_doc_comment_with_no_comment_with_no_source_loc_with_source_loc_enabled() {
let actual = generate_doc_comment(None, None, SourceLocationDocComment::Enabled);
- assert_rs_matches!(actual, quote! {});
+ assert!(actual.is_empty());
}
#[test]
@@ -8814,7 +8814,7 @@
#[test]
fn test_no_generate_doc_comment_with_no_comment_with_no_source_loc_with_source_loc_disabled() {
let actual = generate_doc_comment(None, None, SourceLocationDocComment::Disabled);
- assert_rs_matches!(actual, quote! {});
+ assert!(actual.is_empty());
}
#[test]
@@ -8824,7 +8824,7 @@
Some("google3/some/header;l=13"),
SourceLocationDocComment::Disabled,
);
- assert_rs_matches!(actual, quote! {});
+ assert!(actual.is_empty());
}
#[test]