Fix clippy warnings

This commit is contained in:
Alexandre Bury 2017-03-05 15:18:15 -08:00
parent 6f129ac83d
commit e0b279d9df
3 changed files with 6 additions and 6 deletions

View File

@ -22,8 +22,8 @@ fn main() {
let (tx, rx) = mpsc::channel(); let (tx, rx) = mpsc::channel();
// Generate data in a separate thread. // Generate data in a separate thread.
thread::spawn(|| { thread::spawn(move || {
generate_logs(tx); generate_logs(&tx);
}); });
// And sets the view to read from the other end of the channel. // And sets the view to read from the other end of the channel.
@ -34,7 +34,7 @@ fn main() {
// We will only simulate log generation here. // We will only simulate log generation here.
// In real life, this may come from a running task, a separate process, ... // In real life, this may come from a running task, a separate process, ...
fn generate_logs(tx: mpsc::Sender<String>) { fn generate_logs(tx: &mpsc::Sender<String>) {
let mut i = 1; let mut i = 1;
loop { loop {
let line = format!("Interesting log line {}", i); let line = format!("Interesting log line {}", i);

View File

@ -28,7 +28,7 @@ fn main() {
} }
// Function to simulate a long process. // Function to simulate a long process.
fn fake_load(n_max: usize, counter: Counter) { fn fake_load(n_max: usize, counter: &Counter) {
for _ in 0..n_max { for _ in 0..n_max {
thread::sleep(Duration::from_millis(5)); thread::sleep(Duration::from_millis(5));
// The `counter.tick()` method increases the progress value // The `counter.tick()` method increases the progress value
@ -50,7 +50,7 @@ fn phase_1(s: &mut Cursive) {
.range(0, n_max) .range(0, n_max)
.with_task(move |counter| { .with_task(move |counter| {
// This closure will be called in a separate thread. // This closure will be called in a separate thread.
fake_load(n_max, counter); fake_load(n_max, &counter);
// When we're done, send a callback through the channel // When we're done, send a callback through the channel
cb.send(Box::new(coffee_break)).unwrap(); cb.send(Box::new(coffee_break)).unwrap();

View File

@ -267,7 +267,7 @@ fn make_small_stars(length: usize) -> &'static str {
impl View for EditView { impl View for EditView {
fn draw(&self, printer: &Printer) { fn draw(&self, printer: &Printer) {
assert!(printer.size.x == self.last_length, assert_eq!(printer.size.x, self.last_length,
"Was promised {}, received {}", "Was promised {}, received {}",
self.last_length, self.last_length,
printer.size.x); printer.size.x);