@@ -31,7 +31,7 @@ pub struct Pie<'a, Coord, Label: Display> {
31
31
label_style : TextStyle < ' a > ,
32
32
label_offset : f64 ,
33
33
percentage_style : Option < TextStyle < ' a > > ,
34
- donut_hole : & ' a f64 , // radius of the hole in case of a donut chart
34
+ donut_hole : f64 , // radius of the hole in case of a donut chart
35
35
}
36
36
37
37
impl < ' a , Label : Display > Pie < ' a , ( i32 , i32 ) , Label > {
@@ -63,7 +63,7 @@ impl<'a, Label: Display> Pie<'a, (i32, i32), Label> {
63
63
label_style,
64
64
label_offset : radius_5pct,
65
65
percentage_style : None ,
66
- donut_hole : & 0.0 ,
66
+ donut_hole : 0.0 ,
67
67
}
68
68
}
69
69
@@ -97,8 +97,8 @@ impl<'a, Label: Display> Pie<'a, (i32, i32), Label> {
97
97
/// Enables creating a donut chart with a hole of the specified radius.
98
98
///
99
99
/// The passed value must be greater than zero and lower than the chart overall radius, otherwise it'll be ignored.
100
- pub fn donut_hole ( & mut self , hole_radius : & ' a f64 ) {
101
- if hole_radius > & 0.0 && hole_radius < self . radius {
100
+ pub fn donut_hole ( & mut self , hole_radius : f64 ) {
101
+ if hole_radius > 0.0 && hole_radius < * self . radius {
102
102
self . donut_hole = hole_radius;
103
103
}
104
104
}
@@ -129,7 +129,7 @@ impl<'a, DB: DrawingBackend, Label: Display> Drawable<DB> for Pie<'a, (i32, i32)
129
129
. get ( index)
130
130
. ok_or_else ( || DrawingErrorKind :: FontError ( Box :: new ( PieError :: LengthMismatch ) ) ) ?;
131
131
// start building wedge line against the previous edge
132
- let mut points = if self . donut_hole == & 0.0 {
132
+ let mut points = if self . donut_hole == 0.0 {
133
133
vec ! [ * self . center]
134
134
} else {
135
135
vec ! [ ]
@@ -152,15 +152,15 @@ impl<'a, DB: DrawingBackend, Label: Display> Drawable<DB> for Pie<'a, (i32, i32)
152
152
points. push ( coord) ;
153
153
offset_theta += radian_increment;
154
154
}
155
- if self . donut_hole > & 0.0 {
155
+ if self . donut_hole > 0.0 {
156
156
while offset_theta >= slice_start {
157
- let coord = theta_to_ordinal_coord ( * self . donut_hole , offset_theta, self . center ) ;
157
+ let coord = theta_to_ordinal_coord ( self . donut_hole , offset_theta, self . center ) ;
158
158
points. push ( coord) ;
159
159
offset_theta -= radian_increment;
160
160
}
161
161
}
162
162
// final point of the wedge may not fall exactly on a radian, so add it extra
163
- if self . donut_hole == & 0.0 {
163
+ if self . donut_hole == 0.0 {
164
164
let final_coord = theta_to_ordinal_coord ( * self . radius , theta_final, self . center ) ;
165
165
points. push ( final_coord) ;
166
166
}
@@ -189,7 +189,7 @@ impl<'a, DB: DrawingBackend, Label: Display> Drawable<DB> for Pie<'a, (i32, i32)
189
189
let label_size = backend. estimate_text_size ( & perc_label, percentage_style) ?;
190
190
let text_x_mid = ( label_size. 0 as f64 / 2.0 ) . round ( ) as i32 ;
191
191
let text_y_mid = ( label_size. 1 as f64 / 2.0 ) . round ( ) as i32 ;
192
- let perc_radius = if self . donut_hole == & 0.0 {
192
+ let perc_radius = if self . donut_hole == 0.0 {
193
193
self . radius / 2.0
194
194
} else {
195
195
( self . radius + self . donut_hole ) / 2.0
0 commit comments