@@ -56,17 +56,20 @@ pub struct CodeDisplay<'a> {
56
56
57
57
#[ allow( clippy:: unused_self) ]
58
58
impl < ' a > CodeDisplay < ' a > {
59
+ #[ must_use]
59
60
pub fn hir_callable_decl ( & self , decl : & ' a hir:: CallableDecl ) -> impl Display + ' _ {
60
61
HirCallableDecl { decl }
61
62
}
62
63
64
+ #[ must_use]
63
65
pub fn ast_callable_decl ( & self , decl : & ' a ast:: CallableDecl ) -> impl Display + ' _ {
64
66
AstCallableDecl {
65
67
lookup : self . compilation ,
66
68
decl,
67
69
}
68
70
}
69
71
72
+ #[ must_use]
70
73
pub fn name_ty_id ( & self , name : & ' a str , ty_id : ast:: NodeId ) -> impl Display + ' _ {
71
74
NameTyId {
72
75
lookup : self . compilation ,
@@ -75,22 +78,27 @@ impl<'a> CodeDisplay<'a> {
75
78
}
76
79
}
77
80
81
+ #[ must_use]
78
82
pub fn ident_ty ( & self , ident : & ' a ast:: Ident , ty : & ' a ast:: Ty ) -> impl Display + ' _ {
79
83
IdentTy { ident, ty }
80
84
}
81
85
86
+ #[ must_use]
82
87
pub fn ident_ty_def ( & self , ident : & ' a ast:: Ident , def : & ' a ast:: TyDef ) -> impl Display + ' a {
83
88
IdentTyDef { ident, def }
84
89
}
85
90
91
+ #[ must_use]
86
92
pub fn hir_udt ( & self , udt : & ' a ty:: Udt ) -> impl Display + ' _ {
87
93
HirUdt { udt }
88
94
}
89
95
96
+ #[ must_use]
90
97
pub fn hir_pat ( & self , pat : & ' a hir:: Pat ) -> impl Display + ' _ {
91
98
HirPat { pat }
92
99
}
93
100
101
+ #[ must_use]
94
102
pub fn get_param_offset ( & self , decl : & hir:: CallableDecl ) -> u32 {
95
103
HirCallableDecl { decl } . get_param_offset ( )
96
104
}
@@ -601,13 +609,15 @@ fn eval_functor_expr(expr: &ast::FunctorExpr) -> ty::FunctorSetValue {
601
609
602
610
/// Takes a doc string from Q# and increases all of the markdown header levels by one level.
603
611
/// i.e. `# Summary` becomes `## Summary`
612
+ #[ must_use]
604
613
pub fn increase_header_level ( doc : & str ) -> String {
605
614
let re = Regex :: new ( r"(?mi)^(#+)( [\s\S]+?)$" ) . expect ( "Invalid regex" ) ;
606
615
re. replace_all ( doc, "$1#$2" ) . to_string ( )
607
616
}
608
617
609
618
/// Takes a doc string from Q# and returns the contents of the `# Summary` section. If no
610
619
/// such section can be found, returns the original doc string.
620
+ #[ must_use]
611
621
pub fn parse_doc_for_summary ( doc : & str ) -> String {
612
622
let re = Regex :: new ( r"(?mi)(?:^# Summary$)([\s\S]*?)(?:(^# .*)|\z)" ) . expect ( "Invalid regex" ) ;
613
623
match re. captures ( doc) {
@@ -626,6 +636,7 @@ pub fn parse_doc_for_summary(doc: &str) -> String {
626
636
/// Takes a doc string from a Q# callable and the name of a parameter of
627
637
/// that callable. Returns the description of that parameter found in the
628
638
/// doc string. If no description is found, returns the empty string.
639
+ #[ must_use]
629
640
pub fn parse_doc_for_param ( doc : & str , param : & str ) -> String {
630
641
let re = Regex :: new ( r"(?mi)(?:^# Input$)([\s\S]*?)(?:(^# .*)|\z)" ) . expect ( "Invalid regex" ) ;
631
642
let input = match re. captures ( doc) {
0 commit comments