Skip to content

Commit c80b8b5

Browse files
committed
cargo fmt
1 parent 1345968 commit c80b8b5

File tree

5 files changed

+30
-27
lines changed

5 files changed

+30
-27
lines changed

src/axis.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl Axis {
3434
Axis {
3535
range: Range::new(lower, upper),
3636
ticks: calculate_ticks(lower, upper, default_max_ticks),
37-
label: "".into()
37+
label: "".into(),
3838
}
3939
}
4040

@@ -47,7 +47,8 @@ impl Axis {
4747
}
4848

4949
pub fn label<S>(mut self, l: S) -> Self
50-
where S: Into<String> {
50+
where S: Into<String>
51+
{
5152
self.label = l.into();
5253
self
5354
}

src/scatter.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,6 @@ impl Representation for Scatter {
151151
face_width: u32,
152152
face_height: u32)
153153
-> String {
154-
text_render::render_face_points(self,
155-
x_axis,
156-
y_axis,
157-
face_width,
158-
face_height,
159-
&self.style)
154+
text_render::render_face_points(self, x_axis, y_axis, face_width, face_height, &self.style)
160155
}
161156
}

src/svg_render.rs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ pub fn draw_x_axis(a: &axis::Axis, face_width: f64) -> node::element::Group {
4444
}
4545

4646
let label = node::element::Text::new()
47-
.set("x", face_width/2.)
48-
.set("y", 30)
49-
.set("text-anchor", "middle")
50-
.set("font-size", 12)
51-
.add(node::Text::new(a.get_label()));
47+
.set("x", face_width / 2.)
48+
.set("y", 30)
49+
.set("text-anchor", "middle")
50+
.set("font-size", 12)
51+
.add(node::Text::new(a.get_label()));
5252

5353
node::element::Group::new()
5454
.add(ticks)
@@ -91,12 +91,13 @@ pub fn draw_y_axis(a: &axis::Axis, face_height: f64) -> node::element::Group {
9191
}
9292

9393
let label = node::element::Text::new()
94-
.set("x", -30)
95-
.set("y", -(face_height/2.))
96-
.set("text-anchor", "middle")
97-
.set("font-size", 12)
98-
.set("transform", format!("rotate(-90 {} {})", -30, -(face_height/2.)))
99-
.add(node::Text::new(a.get_label()));
94+
.set("x", -30)
95+
.set("y", -(face_height / 2.))
96+
.set("text-anchor", "middle")
97+
.set("font-size", 12)
98+
.set("transform",
99+
format!("rotate(-90 {} {})", -30, -(face_height / 2.)))
100+
.add(node::Text::new(a.get_label()));
100101

101102
node::element::Group::new()
102103
.add(ticks)
@@ -136,10 +137,10 @@ pub fn draw_face_points(s: &scatter::Scatter,
136137
}
137138
scatter::Marker::Cross => {
138139
let path = node::element::path::Data::new()
139-
.move_to((x_pos-radius, y_pos-radius))
140-
.line_by((radius*2., radius*2.))
141-
.move_by((-radius*2., 0))
142-
.line_by((radius*2., -radius*2.))
140+
.move_to((x_pos - radius, y_pos - radius))
141+
.line_by((radius * 2., radius * 2.))
142+
.move_by((-radius * 2., 0))
143+
.line_by((radius * 2., -radius * 2.))
143144
.close();
144145
group.append(node::element::Path::new()
145146
.set("fill", "none")

src/text_render.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ pub fn render_y_axis_strings(y_axis: &axis::Axis, face_height: u32) -> (String,
132132
.max()
133133
.expect("ERROR: There are no y-axis ticks");
134134

135-
let y_axis_label = format!("{: ^width$}", y_axis.get_label(), width=face_height as usize + 1);
135+
let y_axis_label = format!("{: ^width$}",
136+
y_axis.get_label(),
137+
width = face_height as usize + 1);
136138
let y_axis_label: Vec<_> = y_axis_label.chars().rev().collect();
137139

138140
// Generate a list of strings to label the y-axis
@@ -223,7 +225,9 @@ pub fn render_x_axis_strings(x_axis: &axis::Axis, face_width: u32) -> (String, i
223225
.chain(std::iter::repeat('-').take(face_width as usize))
224226
.collect();
225227

226-
let x_axis_label = format!("{: ^width$}", x_axis.get_label(), width=face_width as usize);
228+
let x_axis_label = format!("{: ^width$}",
229+
x_axis.get_label(),
230+
width = face_width as usize);
227231

228232
let x_axis_string = if start_offset.is_positive() {
229233
let padding = (0..start_offset).map(|_| " ").collect::<String>();

src/view.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,15 @@ impl<'a> View<'a> {
6161
}
6262

6363
pub fn x_label<T>(mut self, value: T) -> Self
64-
where T: Into<String> {
64+
where T: Into<String>
65+
{
6566
self.x_label = Some(value.into());
6667
self
6768
}
6869

6970
pub fn y_label<T>(mut self, value: T) -> Self
70-
where T: Into<String> {
71+
where T: Into<String>
72+
{
7173
self.y_label = Some(value.into());
7274
self
7375
}

0 commit comments

Comments
 (0)