@@ -115,34 +115,27 @@ pub fn create_diagnostics_from_check_result(
115
115
result
116
116
. issues
117
117
. iter ( )
118
- . map ( |issue| create_diagnostic_from_issue ( issue, fn_body, offset, relation. clone ( ) ) )
118
+ . map ( |issue| {
119
+ let severity = match issue. level . as_str ( ) {
120
+ "error" => Severity :: Error ,
121
+ "warning" => Severity :: Warning ,
122
+ "notice" => Severity :: Hint ,
123
+ _ => Severity :: Information ,
124
+ } ;
125
+
126
+ PlPgSqlCheckDiagnostic {
127
+ message : issue. message . clone ( ) . into ( ) ,
128
+ severity,
129
+ span : resolve_span ( issue, fn_body, offset) ,
130
+ advices : PlPgSqlCheckAdvices {
131
+ code : issue. sql_state . clone ( ) ,
132
+ relation : relation. clone ( ) ,
133
+ } ,
134
+ }
135
+ } )
119
136
. collect ( )
120
137
}
121
138
122
- fn create_diagnostic_from_issue (
123
- issue : & PlpgSqlCheckIssue ,
124
- fn_body : & str ,
125
- offset : usize ,
126
- relation : Option < String > ,
127
- ) -> PlPgSqlCheckDiagnostic {
128
- let severity = match issue. level . as_str ( ) {
129
- "error" => Severity :: Error ,
130
- "warning" => Severity :: Warning ,
131
- "notice" => Severity :: Hint ,
132
- _ => Severity :: Information ,
133
- } ;
134
-
135
- PlPgSqlCheckDiagnostic {
136
- message : issue. message . clone ( ) . into ( ) ,
137
- severity,
138
- span : resolve_span ( issue, fn_body, offset) ,
139
- advices : PlPgSqlCheckAdvices {
140
- code : issue. sql_state . clone ( ) ,
141
- relation,
142
- } ,
143
- }
144
- }
145
-
146
139
fn resolve_span ( issue : & PlpgSqlCheckIssue , fn_body : & str , offset : usize ) -> Option < TextRange > {
147
140
let stmt = issue. statement . as_ref ( ) ?;
148
141
0 commit comments