Skip to content

Commit

Permalink
Merge #329
Browse files Browse the repository at this point in the history
329: Use edition 2018. r=Dylan-DPC a=reitermarkus



Co-authored-by: Markus Reiter <me@reitermark.us>
  • Loading branch information
bors[bot] and reitermarkus committed Sep 25, 2019
2 parents 6b85298 + cdf3f62 commit ea29a50
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 57 deletions.
37 changes: 27 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ license = "MIT OR Apache-2.0"
name = "cross"
repository = "https://github.com/rust-embedded/cross"
version = "0.1.16"
edition = "2018"

[dependencies]
atty = "0.2"
error-chain = "0.12"
home = "0.5"
lazy_static = "1.0"
libc = "0.2.18"
rustc_version = "0.2"
Expand Down
4 changes: 2 additions & 2 deletions src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use std::path::{Path, PathBuf};
use std::process::{Command, ExitStatus};
use std::{env, fs};

use errors::*;
use extensions::CommandExt;
use crate::errors::*;
use crate::extensions::CommandExt;

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Subcommand {
Expand Down
6 changes: 3 additions & 3 deletions src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::env;

use Target;
use cargo::Subcommand;
use rustc::TargetList;
use crate::Target;
use crate::cargo::Subcommand;
use crate::rustc::TargetList;

pub struct Args {
pub all: Vec<String>,
Expand Down
18 changes: 9 additions & 9 deletions src/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ use std::process::{Command, ExitStatus};
use std::{env, fs};

use atty::Stream;
use error_chain::bail;
use lazy_static::lazy_static;
use semver::{Version, VersionReq};

use {Target, Toml};
use cargo::Root;
use errors::*;
use extensions::CommandExt;
use id;
use crate::{Target, Toml};
use crate::cargo::Root;
use crate::errors::*;
use crate::extensions::CommandExt;
use crate::id;

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

Expand Down Expand Up @@ -76,10 +78,8 @@ pub fn run(target: &Target,
verbose: bool)
-> Result<ExitStatus> {
let root = root.path();
let home_dir = env::home_dir().ok_or_else(|| "couldn't get home directory. Is $HOME not set?")?;
let cargo_dir = env::var_os("CARGO_HOME")
.map(PathBuf::from)
.unwrap_or_else(|| home_dir.join(".cargo"));
let home_dir = home::home_dir().ok_or_else(|| "could not find home directory")?;
let cargo_dir = home::cargo_home()?;
let xargo_dir = env::var_os("XARGO_HOME")
.map(PathBuf::from)
.unwrap_or_else(|| home_dir.join(".xargo"));
Expand Down
8 changes: 7 additions & 1 deletion src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#![allow(unused_doc_comments)]

error_chain!();
use error_chain::error_chain;

error_chain! {
foreign_links {
Io(std::io::Error);
}
}
2 changes: 1 addition & 1 deletion src/extensions.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::process::{Command, ExitStatus};

use errors::*;
use crate::errors::*;

pub trait CommandExt {
fn run(&mut self, verbose: bool) -> Result<()>;
Expand Down
2 changes: 1 addition & 1 deletion src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::fs::File;
use std::io::Read;
use std::path::Path;

use errors::*;
use crate::errors::*;

pub fn read<P>(path: P) -> Result<String>
where P: AsRef<Path>
Expand Down
6 changes: 3 additions & 3 deletions src/interpreter.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::path::Path;

use errors::*;
use file;
use Target;
use crate::errors::*;
use crate::file;
use crate::Target;

/// Checks if the interpreters have been registered in the host system
pub fn is_registered(target: &Target) -> Result<bool> {
Expand Down
27 changes: 6 additions & 21 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,4 @@
#![deny(missing_debug_implementations)]

extern crate atty;
#[macro_use]
extern crate error_chain;
#[macro_use]
extern crate lazy_static;
extern crate libc;
extern crate rustc_version;
extern crate semver;
extern crate toml;

#[cfg(not(target_os = "windows"))]
extern crate nix;

#[cfg(target_os = "windows")]
extern crate winapi;
#![deny(missing_debug_implementations, rust_2018_idioms)]

mod cargo;
mod cli;
Expand All @@ -31,14 +15,15 @@ use std::io::Write;
use std::process::ExitStatus;
use std::{env, io, process};

use error_chain::bail;
use toml::{Value, value::Table};

use cargo::{Root, Subcommand};
use errors::*;
use rustc::{TargetList, VersionMetaExt};
use self::cargo::{Root, Subcommand};
use self::errors::*;
use self::rustc::{TargetList, VersionMetaExt};

#[allow(non_camel_case_types)]
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, PartialEq)]
pub enum Host {
Other,

Expand Down
6 changes: 3 additions & 3 deletions src/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use std::process::Command;

use rustc_version::{Version, VersionMeta};

use {Host, Target};
use errors::*;
use extensions::CommandExt;
use crate::{Host, Target};
use crate::errors::*;
use crate::extensions::CommandExt;

pub struct TargetList {
triples: Vec<String>,
Expand Down
6 changes: 3 additions & 3 deletions src/rustup.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::process::Command;

use Target;
use errors::*;
use extensions::CommandExt;
use crate::Target;
use crate::errors::*;
use crate::extensions::CommandExt;

#[derive(Debug)]
pub struct AvailableTargets {
Expand Down

0 comments on commit ea29a50

Please sign in to comment.