File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,9 @@ impl fmt::Display for CommentError {
151151
152152impl std:: error:: Error for CommentError { }
153153
154+ /// Alias for comment results that may return a [`CommentError`]
155+ pub type CommentResult < T > = Result < T , CommentError > ;
156+
154157/// Structure that holds the comment along with its location in the file
155158pub struct CommentWithSpan {
156159 comment : Comment ,
@@ -211,12 +214,12 @@ impl Comments {
211214
212215 /// Build all leading comments from a parsed SQL file
213216 #[ must_use]
214- pub fn parse_all_comments_from_file ( file : & ParsedSqlFile ) -> Self {
217+ pub fn parse_all_comments_from_file ( file : & ParsedSqlFile ) -> CommentResult < Self > {
215218 let src = file. content ( ) ;
216219 let mut comments = Vec :: new ( ) ;
217220 let mut current_location = Location :: default ( ) ;
218221
219- Self { comments }
222+ Ok ( Self { comments } )
220223 }
221224
222225 /// Scans the raw file and collects all comments
You can’t perform that action at this time.
0 commit comments