@@ -26,8 +26,7 @@ pub(crate) fn ban_concurrent_index_creation_in_transaction(
2626 Rule :: BanConcurrentIndexCreationInTransaction ,
2727 "While regular index creation can happen inside a transaction, this is not allowed when the `CONCURRENTLY` option is used." . into ( ) ,
2828 concurrently. text_range ( ) ,
29- "Build the index outside any transactions." . to_string ( ) ,
30- ) ) ;
29+ ) . help ( "Build the index outside any transactions." ) ) ;
3130 }
3231 }
3332 }
@@ -45,7 +44,10 @@ pub(crate) fn ban_concurrent_index_creation_in_transaction(
4544mod test {
4645 use insta:: assert_debug_snapshot;
4746
48- use crate :: { Rule , test_utils:: { lint, lint_with_assume_in_transaction} } ;
47+ use crate :: {
48+ Rule ,
49+ test_utils:: { lint, lint_with_assume_in_transaction} ,
50+ } ;
4951
5052 #[ test]
5153 fn ban_concurrent_index_creation_in_transaction_err ( ) {
@@ -77,7 +79,8 @@ mod test {
7779 CREATE UNIQUE INDEX CONCURRENTLY "field_name_idx" ON "table_name" ("field_name");
7880 ALTER TABLE "table_name" ADD CONSTRAINT "field_name_id" UNIQUE USING INDEX "field_name_idx";
7981 "# ;
80- let errors = lint_with_assume_in_transaction ( sql, Rule :: BanConcurrentIndexCreationInTransaction ) ;
82+ let errors =
83+ lint_with_assume_in_transaction ( sql, Rule :: BanConcurrentIndexCreationInTransaction ) ;
8184 assert_ne ! ( errors. len( ) , 0 ) ;
8285 assert_debug_snapshot ! ( errors) ;
8386 }
@@ -88,7 +91,8 @@ mod test {
8891 -- run index creation in a standalone migration
8992 CREATE UNIQUE INDEX CONCURRENTLY "field_name_idx" ON "table_name" ("field_name");
9093 "# ;
91- let errors = lint_with_assume_in_transaction ( sql, Rule :: BanConcurrentIndexCreationInTransaction ) ;
94+ let errors =
95+ lint_with_assume_in_transaction ( sql, Rule :: BanConcurrentIndexCreationInTransaction ) ;
9296 assert_eq ! ( errors. len( ) , 0 ) ;
9397 }
9498
@@ -101,7 +105,8 @@ mod test {
101105 BEGIN;
102106 ALTER TABLE "table_name" ADD CONSTRAINT "field_name_id" UNIQUE USING INDEX "field_name_idx";
103107 "# ;
104- let errors = lint_with_assume_in_transaction ( sql, Rule :: BanConcurrentIndexCreationInTransaction ) ;
108+ let errors =
109+ lint_with_assume_in_transaction ( sql, Rule :: BanConcurrentIndexCreationInTransaction ) ;
105110 assert_eq ! ( errors. len( ) , 0 ) ;
106111 }
107112}
0 commit comments