Skip to content

Commit ea29a50

Browse files
Merge #329
329: Use edition 2018. r=Dylan-DPC a=reitermarkus Co-authored-by: Markus Reiter <[email protected]>
2 parents 6b85298 + cdf3f62 commit ea29a50

File tree

12 files changed

+67
-57
lines changed

12 files changed

+67
-57
lines changed

Cargo.lock

Lines changed: 27 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ license = "MIT OR Apache-2.0"
88
name = "cross"
99
repository = "https://github.com/rust-embedded/cross"
1010
version = "0.1.16"
11+
edition = "2018"
1112

1213
[dependencies]
1314
atty = "0.2"
1415
error-chain = "0.12"
16+
home = "0.5"
1517
lazy_static = "1.0"
1618
libc = "0.2.18"
1719
rustc_version = "0.2"

src/cargo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use std::path::{Path, PathBuf};
22
use std::process::{Command, ExitStatus};
33
use std::{env, fs};
44

5-
use errors::*;
6-
use extensions::CommandExt;
5+
use crate::errors::*;
6+
use crate::extensions::CommandExt;
77

88
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
99
pub enum Subcommand {

src/cli.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::env;
22

3-
use Target;
4-
use cargo::Subcommand;
5-
use rustc::TargetList;
3+
use crate::Target;
4+
use crate::cargo::Subcommand;
5+
use crate::rustc::TargetList;
66

77
pub struct Args {
88
pub all: Vec<String>,

src/docker.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ use std::process::{Command, ExitStatus};
33
use std::{env, fs};
44

55
use atty::Stream;
6+
use error_chain::bail;
7+
use lazy_static::lazy_static;
68
use semver::{Version, VersionReq};
79

8-
use {Target, Toml};
9-
use cargo::Root;
10-
use errors::*;
11-
use extensions::CommandExt;
12-
use id;
10+
use crate::{Target, Toml};
11+
use crate::cargo::Root;
12+
use crate::errors::*;
13+
use crate::extensions::CommandExt;
14+
use crate::id;
1315

1416
const DOCKER_IMAGES: &[&str] = &include!(concat!(env!("OUT_DIR"), "/docker-images.rs"));
1517

@@ -76,10 +78,8 @@ pub fn run(target: &Target,
7678
verbose: bool)
7779
-> Result<ExitStatus> {
7880
let root = root.path();
79-
let home_dir = env::home_dir().ok_or_else(|| "couldn't get home directory. Is $HOME not set?")?;
80-
let cargo_dir = env::var_os("CARGO_HOME")
81-
.map(PathBuf::from)
82-
.unwrap_or_else(|| home_dir.join(".cargo"));
81+
let home_dir = home::home_dir().ok_or_else(|| "could not find home directory")?;
82+
let cargo_dir = home::cargo_home()?;
8383
let xargo_dir = env::var_os("XARGO_HOME")
8484
.map(PathBuf::from)
8585
.unwrap_or_else(|| home_dir.join(".xargo"));

src/errors.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
#![allow(unused_doc_comments)]
22

3-
error_chain!();
3+
use error_chain::error_chain;
4+
5+
error_chain! {
6+
foreign_links {
7+
Io(std::io::Error);
8+
}
9+
}

src/extensions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::process::{Command, ExitStatus};
22

3-
use errors::*;
3+
use crate::errors::*;
44

55
pub trait CommandExt {
66
fn run(&mut self, verbose: bool) -> Result<()>;

src/file.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::fs::File;
22
use std::io::Read;
33
use std::path::Path;
44

5-
use errors::*;
5+
use crate::errors::*;
66

77
pub fn read<P>(path: P) -> Result<String>
88
where P: AsRef<Path>

src/interpreter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use std::path::Path;
22

3-
use errors::*;
4-
use file;
5-
use Target;
3+
use crate::errors::*;
4+
use crate::file;
5+
use crate::Target;
66

77
/// Checks if the interpreters have been registered in the host system
88
pub fn is_registered(target: &Target) -> Result<bool> {

src/main.rs

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,4 @@
1-
#![deny(missing_debug_implementations)]
2-
3-
extern crate atty;
4-
#[macro_use]
5-
extern crate error_chain;
6-
#[macro_use]
7-
extern crate lazy_static;
8-
extern crate libc;
9-
extern crate rustc_version;
10-
extern crate semver;
11-
extern crate toml;
12-
13-
#[cfg(not(target_os = "windows"))]
14-
extern crate nix;
15-
16-
#[cfg(target_os = "windows")]
17-
extern crate winapi;
1+
#![deny(missing_debug_implementations, rust_2018_idioms)]
182

193
mod cargo;
204
mod cli;
@@ -31,14 +15,15 @@ use std::io::Write;
3115
use std::process::ExitStatus;
3216
use std::{env, io, process};
3317

18+
use error_chain::bail;
3419
use toml::{Value, value::Table};
3520

36-
use cargo::{Root, Subcommand};
37-
use errors::*;
38-
use rustc::{TargetList, VersionMetaExt};
21+
use self::cargo::{Root, Subcommand};
22+
use self::errors::*;
23+
use self::rustc::{TargetList, VersionMetaExt};
3924

4025
#[allow(non_camel_case_types)]
41-
#[derive(Debug, Clone, Copy, PartialEq)]
26+
#[derive(Debug, Clone, PartialEq)]
4227
pub enum Host {
4328
Other,
4429

0 commit comments

Comments
 (0)