Skip to content

Commit e55f5ec

Browse files
committed
Run rustfmt
1 parent f9dbb68 commit e55f5ec

17 files changed

+102
-103
lines changed

examples/barchart_svg.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use plotlib::repr::BarChart;
21
use plotlib::page::Page;
2+
use plotlib::repr::BarChart;
33
use plotlib::style::BoxStyle;
44
use plotlib::view::CategoricalView;
55

@@ -9,10 +9,7 @@ fn main() {
99
.label("2")
1010
.style(&BoxStyle::new().fill("darkolivegreen"));
1111

12-
let v = CategoricalView::new()
13-
.add(b1)
14-
.add(b2)
15-
.x_label("Experiment");
12+
let v = CategoricalView::new().add(b1).add(b2).x_label("Experiment");
1613

1714
Page::single(&v).save("barchart.svg").expect("saving svg");
1815
}

examples/boxplot_svg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use plotlib::repr::BoxPlot;
21
use plotlib::page::Page;
2+
use plotlib::repr::BoxPlot;
33
use plotlib::style::BoxStyle;
44
use plotlib::view::CategoricalView;
55

examples/function_svg.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ use plotlib::style::LineStyle;
44
use plotlib::view::ContinuousView;
55

66
fn main() {
7-
let f1 = Plot::from_function(|x| x * 5., 0., 10.).line_style(LineStyle::new().colour("burlywood"));
7+
let f1 =
8+
Plot::from_function(|x| x * 5., 0., 10.).line_style(LineStyle::new().colour("burlywood"));
89
let f2 = Plot::from_function(|x| x.powi(2), 0., 10.)
910
.line_style(LineStyle::new().colour("darkolivegreen").width(2.));
1011
let f3 = Plot::from_function(|x| x.sqrt() * 20., 0., 10.)

examples/histogram_svg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use plotlib::repr::{Histogram, HistogramBins};
21
use plotlib::page::Page;
2+
use plotlib::repr::{Histogram, HistogramBins};
33
use plotlib::style::BoxStyle;
44
use plotlib::view::ContinuousView;
55

examples/histogram_text.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use plotlib::repr::{HistogramBins, Histogram};
21
use plotlib::page::Page;
2+
use plotlib::repr::{Histogram, HistogramBins};
33
use plotlib::view::ContinuousView;
44

55
fn main() {

examples/letter_counter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use std::collections::btree_map::BTreeMap;
21
use plotlib::style::BoxStyle;
2+
use std::collections::btree_map::BTreeMap;
33

44
fn main() {
55
let mut data = Vec::new();
@@ -18,7 +18,7 @@ fn main() {
1818
let count = *count as f64;
1919
data.push(plotlib::repr::BarChart::new(count).label(ch.to_string()));
2020
}
21-
// Add data to the view
21+
// Add data to the view
2222
let v = data
2323
.into_iter()
2424
.fold(plotlib::view::CategoricalView::new(), |view, datum| {

examples/line_and_point_svg.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ use plotlib::view::ContinuousView;
55

66
fn main() {
77
let l1 = Plot::new(vec![(0., 1.), (2., 1.5), (3., 1.2), (4., 1.1)])
8-
.line_style(LineStyle::new().colour("burlywood").linejoin(LineJoin::Round))
8+
.line_style(
9+
LineStyle::new()
10+
.colour("burlywood")
11+
.linejoin(LineJoin::Round),
12+
)
913
.point_style(PointStyle::new());
10-
14+
1115
let v = ContinuousView::new().add(l1);
12-
Page::single(&v).save("line_and_point.svg").expect("saving svg");
16+
Page::single(&v)
17+
.save("line_and_point.svg")
18+
.expect("saving svg");
1319
}

examples/scatter_svg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use plotlib::page::Page;
22
use plotlib::repr::Plot;
3-
use plotlib::view::ContinuousView;
43
use plotlib::style::{PointMarker, PointStyle};
4+
use plotlib::view::ContinuousView;
55

66
fn main() {
77
// Scatter plots expect a list of pairs
@@ -39,4 +39,4 @@ fn main() {
3939

4040
// A page with a single view is then saved to an SVG file
4141
Page::single(&v).save("scatter.svg").unwrap();
42-
}
42+
}

examples/with_grid.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use plotlib::repr::{BarChart, Plot};
21
use plotlib::grid::Grid;
32
use plotlib::page::Page;
3+
use plotlib::repr::{BarChart, Plot};
44
use plotlib::style::{BoxStyle, LineStyle};
55
use plotlib::view::{CategoricalView, ContinuousView, View};
66

@@ -30,10 +30,7 @@ where
3030
let b2 = BarChart::new(2.6)
3131
.label("2")
3232
.style(&BoxStyle::new().fill("darkolivegreen"));
33-
let mut v = CategoricalView::new()
34-
.add(b1)
35-
.add(b2)
36-
.x_label("Experiment");
33+
let mut v = CategoricalView::new().add(b1).add(b2).x_label("Experiment");
3734
v.add_grid(Grid::new(3, 8));
3835
Page::single(&v)
3936
.save(filename.as_ref())

src/axis.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,7 @@ impl TickSteps {
109109
fn start_at(start: f64) -> TickSteps {
110110
let start_options = TickSteps::scaled_steps(start);
111111
let overflow = start_options[0] * 10.0;
112-
let curr = start_options
113-
.iter()
114-
.find(|&step| step >= &start);
112+
let curr = start_options.iter().find(|&step| step >= &start);
115113

116114
TickSteps {
117115
next: *curr.unwrap_or(&overflow),
@@ -135,10 +133,7 @@ impl Iterator for TickSteps {
135133
let curr = self.next; // cache the value we're currently on
136134
let curr_steps = TickSteps::scaled_steps(self.next);
137135
let overflow = curr_steps[0] * 10.0;
138-
self.next = *curr_steps
139-
.iter()
140-
.find(|&s| s > &curr)
141-
.unwrap_or(&overflow);
136+
self.next = *curr_steps.iter().find(|&s| s > &curr).unwrap_or(&overflow);
142137
Some(curr)
143138
}
144139
}

0 commit comments

Comments
 (0)