Skip to content

Commit a8f248d

Browse files
stuhoodillicitonion
authored andcommitted
Update to rust 1.26, and explicitly use Itertools::flatten to avoid rust-lang/rust#48919. Additionally, apply rustfmt changes.
1 parent 0d34f54 commit a8f248d

File tree

12 files changed

+44
-45
lines changed

12 files changed

+44
-45
lines changed

build-support/bin/native/bootstrap.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ esac
4545
readonly CACHE_ROOT=${XDG_CACHE_HOME:-$HOME/.cache}/pants
4646
readonly NATIVE_ENGINE_CACHE_DIR=${CACHE_ROOT}/bin/native-engine
4747

48-
readonly RUST_TOOLCHAIN="1.25.0"
48+
readonly RUST_TOOLCHAIN="1.26.0"
4949

5050
function calculate_current_hash() {
5151
# Cached and unstaged files, with ignored files excluded.

src/rust/engine/fs/brfs/src/main.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -643,13 +643,13 @@ mod test {
643643
extern crate tempdir;
644644
extern crate testutil;
645645

646+
use self::tempdir::TempDir;
647+
use self::testutil::{file, data::{TestData, TestDirectory}};
648+
use super::mount;
646649
use fs;
647650
use futures::future::Future;
648651
use hashing;
649-
use self::tempdir::TempDir;
650652
use std::sync::Arc;
651-
use super::mount;
652-
use self::testutil::{file, data::{TestData, TestDirectory}};
653653

654654
#[test]
655655
fn missing_digest() {
@@ -888,16 +888,16 @@ mod syscall_tests {
888888
extern crate tempdir;
889889
extern crate testutil;
890890

891+
use self::tempdir::TempDir;
892+
use self::testutil::data::TestData;
893+
use super::mount;
894+
use super::test::digest_to_filepath;
891895
use fs;
892896
use futures::Future;
893897
use libc;
894-
use std::sync::Arc;
895-
use super::mount;
896-
use super::test::digest_to_filepath;
897-
use self::tempdir::TempDir;
898-
use self::testutil::data::TestData;
899898
use std::ffi::CString;
900899
use std::path::Path;
900+
use std::sync::Arc;
901901

902902
#[test]
903903
fn read_file_by_digest_exact_bytes() {

src/rust/engine/fs/src/lib.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ extern crate tempdir;
3636
#[cfg(test)]
3737
extern crate testutil;
3838

39+
use std::cmp::min;
3940
use std::collections::HashSet;
41+
use std::io::{self, Read};
4042
use std::os::unix::fs::PermissionsExt;
4143
use std::path::{Component, Path, PathBuf};
4244
use std::sync::Arc;
4345
use std::{fmt, fs};
44-
use std::io::{self, Read};
45-
use std::cmp::min;
4646

4747
use bytes::Bytes;
4848
use futures::future::{self, Future};
@@ -122,12 +122,9 @@ impl PathStat {
122122

123123
lazy_static! {
124124
static ref PARENT_DIR: &'static str = "..";
125-
126125
static ref SINGLE_STAR_GLOB: Pattern = Pattern::new("*").unwrap();
127-
128126
static ref DOUBLE_STAR: &'static str = "**";
129127
static ref DOUBLE_STAR_GLOB: Pattern = Pattern::new("**").unwrap();
130-
131128
static ref EMPTY_IGNORE: Arc<Gitignore> = Arc::new(Gitignore::empty());
132129
}
133130

@@ -851,9 +848,9 @@ mod posixfs_test {
851848
extern crate tempdir;
852849
extern crate testutil;
853850

851+
use self::testutil::make_file;
854852
use super::{Dir, File, Link, PathStat, PathStatGetter, PosixFS, ResettablePool, Stat};
855853
use futures::Future;
856-
use self::testutil::make_file;
857854
use std;
858855
use std::path::{Path, PathBuf};
859856
use std::sync::Arc;

src/rust/engine/fs/src/pool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
use std::sync::RwLock;
55

6-
use futures_cpupool::{self, CpuFuture, CpuPool};
76
use futures::future::IntoFuture;
7+
use futures_cpupool::{self, CpuFuture, CpuPool};
88

99
///
1010
/// A wrapper around a CpuPool, to add the ability to drop the pool before forking,

src/rust/engine/fs/src/store.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -563,9 +563,9 @@ mod local {
563563
use bytes::Bytes;
564564
use digest::{Digest as DigestTrait, FixedOutput};
565565
use hashing::{Digest, Fingerprint};
566+
use lmdb::Error::{KeyExist, NotFound};
566567
use lmdb::{self, Cursor, Database, DatabaseFlags, Environment, RwTransaction, Transaction,
567568
WriteFlags, NO_OVERWRITE, NO_SYNC, NO_TLS};
568-
use lmdb::Error::{KeyExist, NotFound};
569569
use resettable::Resettable;
570570
use sha2::Sha256;
571571
use std::collections::{BinaryHeap, HashMap};
@@ -574,8 +574,8 @@ mod local {
574574
use std::sync::Arc;
575575
use std::time;
576576

577-
use pool::ResettablePool;
578577
use super::MAX_LOCAL_STORE_SIZE_BYTES;
578+
use pool::ResettablePool;
579579

580580
#[derive(Clone)]
581581
pub struct ByteStore {
@@ -985,11 +985,11 @@ mod local {
985985

986986
#[cfg(test)]
987987
pub mod tests {
988+
use super::super::super::safe_create_dir_all;
989+
use super::{ByteStore, EntryType, ResettablePool};
988990
use bytes::Bytes;
989991
use futures::Future;
990992
use hashing::{Digest, Fingerprint};
991-
use super::{ByteStore, EntryType, ResettablePool};
992-
use super::super::super::safe_create_dir_all;
993993
use lmdb::{DatabaseFlags, Environment, Transaction, WriteFlags};
994994
use std::path::Path;
995995
use std::sync::Arc;
@@ -1487,8 +1487,8 @@ mod remote {
14871487
use bytes::{Bytes, BytesMut};
14881488
use digest::{Digest as DigestTrait, FixedOutput};
14891489
use futures::{self, future, Future, Sink, Stream};
1490-
use hashing::{Digest, Fingerprint};
14911490
use grpcio;
1491+
use hashing::{Digest, Fingerprint};
14921492
use resettable::Resettable;
14931493
use sha2::Sha256;
14941494
use std::cmp::min;
@@ -1704,8 +1704,8 @@ mod remote {
17041704

17051705
extern crate tempdir;
17061706

1707-
use super::ByteStore;
17081707
use super::super::EntryType;
1708+
use super::ByteStore;
17091709
use bytes::Bytes;
17101710
use futures::Future;
17111711
use hashing::Digest;

src/rust/engine/process_execution/src/local.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ pub fn run_command_locally(
3434
mod tests {
3535
extern crate testutil;
3636

37+
use self::testutil::{as_bytes, owned_string_vec};
3738
use super::{run_command_locally, ExecuteProcessRequest, ExecuteProcessResult};
3839
use fs;
3940
use std::collections::BTreeMap;
4041
use std::path::PathBuf;
41-
use self::testutil::{as_bytes, owned_string_vec};
4242

4343
#[test]
4444
#[cfg(unix)]

src/rust/engine/process_execution/src/remote.rs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use digest::{Digest as DigestTrait, FixedOutput};
88
use fs::Store;
99
use futures::{future, Future};
1010
use futures_timer::Delay;
11-
use hashing::{Digest, Fingerprint};
1211
use grpcio;
12+
use hashing::{Digest, Fingerprint};
1313
use protobuf::{self, Message, ProtobufEnum};
1414
use resettable::Resettable;
1515
use sha2::Sha256;
@@ -38,14 +38,14 @@ enum ExecutionError {
3838
}
3939

4040
macro_rules! try_future {
41-
( $x:expr) => {
42-
{
43-
match $x {
44-
Ok(value) => {value}
45-
Err(error) => {return future::err(error).to_boxed();}
46-
}
41+
($x:expr) => {{
42+
match $x {
43+
Ok(value) => value,
44+
Err(error) => {
45+
return future::err(error).to_boxed();
46+
}
4747
}
48-
};
48+
}};
4949
}
5050

5151
impl CommandRunner {
@@ -278,10 +278,12 @@ impl CommandRunner {
278278
try_future!(
279279
precondition_failure
280280
.merge_from_bytes(details.get_value())
281-
.map_err(|e| ExecutionError::Fatal(format!(
282-
"Error deserializing FailedPrecondition proto: {:?}",
283-
e
284-
)))
281+
.map_err(|e| {
282+
ExecutionError::Fatal(format!(
283+
"Error deserializing FailedPrecondition proto: {:?}",
284+
e
285+
))
286+
})
285287
);
286288

287289
let mut missing_digests =
@@ -474,8 +476,8 @@ mod tests {
474476
use futures::Future;
475477
use grpcio;
476478
use hashing::Digest;
477-
use protobuf::{self, Message, ProtobufEnum};
478479
use mock;
480+
use protobuf::{self, Message, ProtobufEnum};
479481
use tempdir::TempDir;
480482
use testutil::data::{TestData, TestDirectory};
481483
use testutil::{as_bytes, owned_string_vec};

src/rust/engine/process_executor/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ extern crate tempdir;
1010
use clap::{App, AppSettings, Arg};
1111
use futures::future::Future;
1212
use hashing::{Digest, Fingerprint};
13-
use tempdir::TempDir;
1413
use std::collections::BTreeMap;
1514
use std::iter::Iterator;
1615
use std::process::exit;
1716
use std::sync::Arc;
1817
use std::time::Duration;
18+
use tempdir::TempDir;
1919

2020
/// A binary which takes args of format:
2121
/// process_executor --env=FOO=bar --env=SOME=value --input-digest=abc123 --input-digest-length=80

src/rust/engine/src/core.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
use fnv::FnvHasher;
55

66
use std::collections::HashMap;
7-
use std::{fmt, hash};
87
use std::ops::Drop;
8+
use std::{fmt, hash};
99

1010
use externs;
1111
use handles::{enqueue_drop_handle, Handle};

src/rust/engine/src/graph.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ use std::io::{self, BufWriter, Write};
88
use std::path::{Path, PathBuf};
99
use std::sync::Mutex;
1010

11+
use futures::future::{self, Future};
1112
use petgraph::Direction;
1213
use petgraph::stable_graph::{NodeIndex, StableDiGraph, StableGraph};
13-
use futures::future::{self, Future};
1414

15-
use externs;
1615
use boxfuture::Boxable;
1716
use context::ContextFactory;
1817
use core::{Failure, Noop, FNV};
18+
use externs;
1919
use hashing;
2020
use nodes::{DigestFile, Node, NodeFuture, NodeKey, NodeResult, TryInto};
2121

@@ -341,7 +341,7 @@ impl InnerGraph {
341341
};
342342

343343
try!(f.write_all(b"digraph plans {\n"));
344-
try!(f.write_fmt(format_args!(" node[colorscheme={}];\n", viz_color_scheme),));
344+
try!(f.write_fmt(format_args!(" node[colorscheme={}];\n", viz_color_scheme)));
345345
try!(f.write_all(b" concentrate=true;\n"));
346346
try!(f.write_all(b" rankdir=TB;\n"));
347347

@@ -371,7 +371,7 @@ impl InnerGraph {
371371

372372
// Write an entry per edge.
373373
let dep_str = dep_entry.format::<NodeKey>();
374-
try!(f.write_fmt(format_args!(" \"{}\" -> \"{}\"\n", node_str, dep_str),));
374+
try!(f.write_fmt(format_args!(" \"{}\" -> \"{}\"\n", node_str, dep_str)));
375375
}
376376
}
377377

src/rust/engine/src/nodes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
extern crate bazel_protos;
55
extern crate tempdir;
66

7-
use std::error::Error;
87
use std::collections::BTreeMap;
8+
use std::error::Error;
99
use std::fmt;
1010
use std::os::unix::ffi::OsStrExt;
1111
use std::path::{Path, PathBuf};
@@ -19,8 +19,8 @@ use context::Context;
1919
use core::{throw, Failure, Key, Noop, TypeConstraint, Value, Variants};
2020
use externs;
2121
use fs::{self, Dir, File, FileContent, Link, PathGlobs, PathStat, StoreFileByDigest, VFS};
22-
use process_execution;
2322
use hashing;
23+
use process_execution;
2424
use rule_graph;
2525
use selectors;
2626
use tasks::{self, Intrinsic, IntrinsicKind};

src/rust/engine/src/rule_graph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Licensed under the Apache License, Version 2.0 (see LICENSE).
33

44
use std::collections::{hash_map, HashMap, HashSet, VecDeque};
5-
use std::hash::Hash;
65
use std::fmt;
6+
use std::hash::Hash;
77
use std::io;
88

99
use core::{Function, Key, TypeConstraint, TypeId, Value, ANY_TYPE};

0 commit comments

Comments
 (0)