@@ -16,22 +16,22 @@ pub trait ToParameter {
16
16
17
17
impl ToParameter for CParameter {
18
18
fn to_parameter ( & self , env : & Env , bounds : & Bounds ) -> String {
19
- let mut_str = if self . ref_mode == RefMode :: ByRefMut {
20
- " mut "
21
- } else {
22
- ""
19
+ let ref_str = match self . ref_mode {
20
+ RefMode :: ByRefMut => "& mut ",
21
+ RefMode :: None => "" ,
22
+ _ => "&" ,
23
23
} ;
24
24
if self . instance_parameter {
25
- format ! ( "& {}self" , mut_str )
25
+ format ! ( "{}self" , ref_str )
26
26
} else {
27
27
let type_str: String ;
28
28
match bounds. get_parameter_alias_info ( & self . name ) {
29
29
Some ( ( t, bound_type) ) => match bound_type {
30
30
BoundType :: NoWrapper => type_str = t. to_string ( ) ,
31
31
BoundType :: IsA ( _) if * self . nullable => {
32
- type_str = format ! ( "Option<& {}{}>" , mut_str , t)
32
+ type_str = format ! ( "Option<{}{}>" , ref_str , t)
33
33
}
34
- BoundType :: IsA ( _) => type_str = format ! ( "& {}{}" , mut_str , t) ,
34
+ BoundType :: IsA ( _) => type_str = format ! ( "{}{}" , ref_str , t) ,
35
35
BoundType :: AsRef ( _) => type_str = t. to_string ( ) ,
36
36
} ,
37
37
None => {
0 commit comments