From d4aa3a223137e28fe574c36e339cece2315a67e0 Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Mon, 25 May 2020 11:48:39 -0500 Subject: [PATCH] fix 'edition="2018"' module import errors - ref: @@ --- src/uu/cut/src/cut.rs | 8 +++--- src/uu/dircolors/src/dircolors.rs | 2 +- src/uu/expr/src/syntax_tree.rs | 3 ++- src/uu/factor/build.rs | 3 ++- src/uu/factor/src/rho.rs | 7 +++--- src/uu/factor/src/table.rs | 3 ++- src/uu/fmt/src/fmt.rs | 5 ++-- src/uu/fmt/src/linebreak.rs | 5 ++-- src/uu/fmt/src/parasplit.rs | 5 ++-- src/uu/hashsum/src/digest.rs | 3 ++- src/uu/hashsum/src/hashsum.rs | 3 ++- src/uu/mkdir/Cargo.toml | 2 +- src/uu/mkdir/src/mkdir.rs | 3 +-- src/uu/nl/src/helper.rs | 18 ++++++------- src/uu/od/src/formatteriteminfo.rs | 2 +- src/uu/od/src/inputdecoder.rs | 7 +++--- src/uu/od/src/od.rs | 25 ++++++++++--------- src/uu/od/src/output_info.rs | 5 ++-- src/uu/od/src/parse_formats.rs | 8 +++--- src/uu/od/src/partialreader.rs | 3 ++- src/uu/od/src/peekreader.rs | 3 ++- src/uu/od/src/prn_char.rs | 3 ++- src/uu/od/src/prn_float.rs | 3 ++- src/uu/od/src/prn_int.rs | 2 +- src/uu/printf/src/memo.rs | 9 ++++--- .../src/tokenize/num_format/formatter.rs | 6 +++-- .../src/tokenize/num_format/num_format.rs | 8 +++--- src/uu/printf/src/tokenize/sub.rs | 11 ++++---- src/uu/printf/src/tokenize/unescaped_text.rs | 6 +++-- src/uu/stat/Cargo.toml | 2 +- src/uu/stat/src/fsext.rs | 13 +++++----- src/uu/stat/src/stat.rs | 2 +- src/uu/tr/src/tr.rs | 6 ++--- src/uu/uptime/Cargo.toml | 2 +- src/uu/uptime/src/uptime.rs | 6 ++--- 35 files changed, 112 insertions(+), 90 deletions(-) diff --git a/src/uu/cut/src/cut.rs b/src/uu/cut/src/cut.rs index 16f0fbd64..1d4381855 100644 --- a/src/uu/cut/src/cut.rs +++ b/src/uu/cut/src/cut.rs @@ -12,8 +12,8 @@ use std::fs::File; use std::io::{stdin, stdout, BufRead, BufReader, Read, Stdout, Write}; use std::path::Path; -use ranges::Range; -use searcher::Searcher; +use self::ranges::Range; +use self::searcher::Searcher; mod buffer; mod ranges; @@ -130,8 +130,8 @@ fn list_to_ranges(list: &str, complement: bool) -> Result, String> { } fn cut_bytes(reader: R, ranges: &[Range], opts: &Options) -> i32 { - use buffer::Bytes::Select; - use buffer::Bytes::Selected::*; + use self::buffer::Bytes::Select; + use self::buffer::Bytes::Selected::*; let newline_char = if opts.zero_terminated { b'\0' } else { b'\n' }; let mut buf_read = buffer::ByteReader::new(reader, newline_char); diff --git a/src/uu/dircolors/src/dircolors.rs b/src/uu/dircolors/src/dircolors.rs index 1f123dc80..500815d60 100644 --- a/src/uu/dircolors/src/dircolors.rs +++ b/src/uu/dircolors/src/dircolors.rs @@ -24,7 +24,7 @@ static LONG_HELP: &str = " "; mod colors; -use colors::INTERNAL_DB; +use self::colors::INTERNAL_DB; #[derive(PartialEq, Debug)] pub enum OutputFmt { diff --git a/src/uu/expr/src/syntax_tree.rs b/src/uu/expr/src/syntax_tree.rs index b8572b2a9..85a1efedb 100644 --- a/src/uu/expr/src/syntax_tree.rs +++ b/src/uu/expr/src/syntax_tree.rs @@ -11,7 +11,8 @@ //! use onig::{Regex, RegexOptions, Syntax}; -use tokens::Token; + +use crate::tokens::Token; type TokenStack = Vec<(usize, Token)>; pub type OperandsList = Vec>; diff --git a/src/uu/factor/build.rs b/src/uu/factor/build.rs index e66afadb0..3a05d7fdd 100644 --- a/src/uu/factor/build.rs +++ b/src/uu/factor/build.rs @@ -15,7 +15,6 @@ #![cfg_attr(test, allow(dead_code))] -use sieve::Sieve; use std::env::{self, args}; use std::fs::File; use std::io::Write; @@ -23,6 +22,8 @@ use std::num::Wrapping; use std::path::Path; use std::u64::MAX as MAX_U64; +use self::sieve::Sieve; + #[cfg(test)] use miller_rabin::is_prime; diff --git a/src/uu/factor/src/rho.rs b/src/uu/factor/src/rho.rs index e864519c9..6caded033 100644 --- a/src/uu/factor/src/rho.rs +++ b/src/uu/factor/src/rho.rs @@ -1,11 +1,12 @@ -use crate::miller_rabin::Result::*; -use crate::{miller_rabin, Factors}; -use numeric::*; use rand::distributions::{Distribution, Uniform}; use rand::rngs::SmallRng; use rand::{thread_rng, SeedableRng}; use std::cmp::{max, min}; +use crate::miller_rabin::Result::*; +use crate::numeric::*; +use crate::{miller_rabin, Factors}; + fn find_divisor(n: u64) -> u64 { #![allow(clippy::many_single_char_names)] let mut rand = { diff --git a/src/uu/factor/src/table.rs b/src/uu/factor/src/table.rs index 3a4f44e85..1edf6bad8 100644 --- a/src/uu/factor/src/table.rs +++ b/src/uu/factor/src/table.rs @@ -1,6 +1,7 @@ -use crate::Factors; use std::num::Wrapping; +use crate::Factors; + include!(concat!(env!("OUT_DIR"), "/prime_table.rs")); pub(crate) fn factor(mut num: u64) -> (Factors, u64) { diff --git a/src/uu/fmt/src/fmt.rs b/src/uu/fmt/src/fmt.rs index ccd374fa7..7d7d2156c 100644 --- a/src/uu/fmt/src/fmt.rs +++ b/src/uu/fmt/src/fmt.rs @@ -10,13 +10,14 @@ extern crate unicode_width; #[macro_use] extern crate uucore; -use linebreak::break_lines; -use parasplit::ParagraphStream; use std::cmp; use std::fs::File; use std::io::{stdin, stdout, Write}; use std::io::{BufReader, BufWriter, Read}; +use self::linebreak::break_lines; +use self::parasplit::ParagraphStream; + macro_rules! silent_unwrap( ($exp:expr) => ( match $exp { diff --git a/src/uu/fmt/src/linebreak.rs b/src/uu/fmt/src/linebreak.rs index 8a8b9408e..a0d445174 100644 --- a/src/uu/fmt/src/linebreak.rs +++ b/src/uu/fmt/src/linebreak.rs @@ -5,12 +5,13 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -use parasplit::{ParaWords, Paragraph, WordInfo}; use std::cmp; use std::i64; use std::io::{BufWriter, Stdout, Write}; use std::mem; -use FmtOptions; + +use crate::parasplit::{ParaWords, Paragraph, WordInfo}; +use crate::FmtOptions; struct BreakArgs<'a> { opts: &'a FmtOptions, diff --git a/src/uu/fmt/src/parasplit.rs b/src/uu/fmt/src/parasplit.rs index e193450fa..c3315402f 100644 --- a/src/uu/fmt/src/parasplit.rs +++ b/src/uu/fmt/src/parasplit.rs @@ -9,8 +9,9 @@ use std::io::{BufRead, Lines}; use std::iter::Peekable; use std::slice::Iter; use unicode_width::UnicodeWidthChar; -use FileOrStdReader; -use FmtOptions; + +use crate::FileOrStdReader; +use crate::FmtOptions; fn char_width(c: char) -> usize { if (c as usize) < 0xA0 { diff --git a/src/uu/hashsum/src/digest.rs b/src/uu/hashsum/src/digest.rs index 498d01a2d..ea2953dfd 100644 --- a/src/uu/hashsum/src/digest.rs +++ b/src/uu/hashsum/src/digest.rs @@ -4,9 +4,10 @@ extern crate sha1; extern crate sha2; extern crate sha3; -use digest::digest::{ExtendableOutput, Input, XofReader}; use hex::ToHex; +use crate::digest::digest::{ExtendableOutput, Input, XofReader}; + pub trait Digest { fn new() -> Self where diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index a1b3f2a8a..afcc80361 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -21,7 +21,8 @@ extern crate uucore; mod digest; -use digest::Digest; +use self::digest::Digest; + use hex::ToHex; use md5::Context as Md5; use regex::Regex; diff --git a/src/uu/mkdir/Cargo.toml b/src/uu/mkdir/Cargo.toml index 79cc6825d..e9b181520 100644 --- a/src/uu/mkdir/Cargo.toml +++ b/src/uu/mkdir/Cargo.toml @@ -17,7 +17,7 @@ path = "src/mkdir.rs" [dependencies] getopts = "0.2.18" libc = "0.2.42" -uucore = { version="0.0.3", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["mode"] } +uucore = { version="0.0.3", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["fs", "mode"] } uucore_procs = { version="0.0.3", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } [[bin]] diff --git a/src/uu/mkdir/src/mkdir.rs b/src/uu/mkdir/src/mkdir.rs index c287ecddc..9a01b1202 100644 --- a/src/uu/mkdir/src/mkdir.rs +++ b/src/uu/mkdir/src/mkdir.rs @@ -6,7 +6,6 @@ // * file that was distributed with this source code. extern crate getopts; -extern crate libc; #[macro_use] extern crate uucore; @@ -124,7 +123,7 @@ fn mkdir(path: &Path, recursive: bool, mode: u16, verbose: bool) -> i32 { #[cfg(any(unix, target_os = "redox"))] fn chmod(path: &Path, mode: u16) -> i32 { - use fs::{set_permissions, Permissions}; + use std::fs::{set_permissions, Permissions}; use std::os::unix::fs::PermissionsExt; let mode = Permissions::from_mode(u32::from(mode)); diff --git a/src/uu/nl/src/helper.rs b/src/uu/nl/src/helper.rs index b34c2a1e1..2eb5fa555 100644 --- a/src/uu/nl/src/helper.rs +++ b/src/uu/nl/src/helper.rs @@ -2,17 +2,17 @@ extern crate getopts; extern crate regex; // parse_style parses a style string into a NumberingStyle. -fn parse_style(chars: &[char]) -> Result<::NumberingStyle, String> { +fn parse_style(chars: &[char]) -> Result { if chars.len() == 1 && chars[0] == 'a' { - Ok(::NumberingStyle::NumberForAll) + Ok(crate::NumberingStyle::NumberForAll) } else if chars.len() == 1 && chars[0] == 't' { - Ok(::NumberingStyle::NumberForNonEmpty) + Ok(crate::NumberingStyle::NumberForNonEmpty) } else if chars.len() == 1 && chars[0] == 'n' { - Ok(::NumberingStyle::NumberForNone) + Ok(crate::NumberingStyle::NumberForNone) } else if chars.len() > 1 && chars[0] == 'p' { let s: String = chars[1..].iter().cloned().collect(); match regex::Regex::new(&s) { - Ok(re) => Ok(::NumberingStyle::NumberForRegularExpression(re)), + Ok(re) => Ok(crate::NumberingStyle::NumberForRegularExpression(re)), Err(_) => Err(String::from("Illegal regular expression")), } } else { @@ -22,7 +22,7 @@ fn parse_style(chars: &[char]) -> Result<::NumberingStyle, String> { // parse_options loads the options into the settings, returning an array of // error messages. -pub fn parse_options(settings: &mut ::Settings, opts: &getopts::Matches) -> Vec { +pub fn parse_options(settings: &mut crate::Settings, opts: &getopts::Matches) -> Vec { // This vector holds error messages encountered. let mut errs: Vec = vec![]; settings.renumber = !opts.opt_present("p"); @@ -36,13 +36,13 @@ pub fn parse_options(settings: &mut ::Settings, opts: &getopts::Matches) -> Vec< None => {} Some(val) => match val.as_ref() { "ln" => { - settings.number_format = ::NumberFormat::Left; + settings.number_format = crate::NumberFormat::Left; } "rn" => { - settings.number_format = ::NumberFormat::Right; + settings.number_format = crate::NumberFormat::Right; } "rz" => { - settings.number_format = ::NumberFormat::RightZero; + settings.number_format = crate::NumberFormat::RightZero; } _ => { errs.push(String::from("Illegal value for -n")); diff --git a/src/uu/od/src/formatteriteminfo.rs b/src/uu/od/src/formatteriteminfo.rs index 946106fc7..f7ca8d8ac 100644 --- a/src/uu/od/src/formatteriteminfo.rs +++ b/src/uu/od/src/formatteriteminfo.rs @@ -16,7 +16,7 @@ impl Clone for FormatWriter { impl PartialEq for FormatWriter { fn eq(&self, other: &FormatWriter) -> bool { - use formatteriteminfo::FormatWriter::*; + use crate::formatteriteminfo::FormatWriter::*; match (self, other) { (&IntWriter(ref a), &IntWriter(ref b)) => a == b, diff --git a/src/uu/od/src/inputdecoder.rs b/src/uu/od/src/inputdecoder.rs index ea75ef237..0bc6113b9 100644 --- a/src/uu/od/src/inputdecoder.rs +++ b/src/uu/od/src/inputdecoder.rs @@ -1,9 +1,10 @@ -use byteorder_io::ByteOrder; use half::f16; -use multifilereader::HasError; -use peekreader::PeekRead; use std::io; +use crate::byteorder_io::ByteOrder; +use crate::multifilereader::HasError; +use crate::peekreader::PeekRead; + /// Processes an input and provides access to the data read in various formats /// /// Currently only useful if the input implements `PeekRead`. diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index 653313966..e007010a8 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -29,20 +29,21 @@ mod prn_char; mod prn_float; mod prn_int; -use byteorder_io::*; -use formatteriteminfo::*; -use inputdecoder::{InputDecoder, MemoryDecoder}; -use inputoffset::{InputOffset, Radix}; -use multifilereader::*; -use output_info::OutputInfo; -use parse_formats::{parse_format_flags, ParsedFormatterItemInfo}; -use parse_inputs::{parse_inputs, CommandLineInputs}; -use parse_nrofbytes::parse_number_of_bytes; -use partialreader::*; -use peekreader::*; -use prn_char::format_ascii_dump; use std::cmp; +use crate::byteorder_io::*; +use crate::formatteriteminfo::*; +use crate::inputdecoder::{InputDecoder, MemoryDecoder}; +use crate::inputoffset::{InputOffset, Radix}; +use crate::multifilereader::*; +use crate::output_info::OutputInfo; +use crate::parse_formats::{parse_format_flags, ParsedFormatterItemInfo}; +use crate::parse_inputs::{parse_inputs, CommandLineInputs}; +use crate::parse_nrofbytes::parse_number_of_bytes; +use crate::partialreader::*; +use crate::peekreader::*; +use crate::prn_char::format_ascii_dump; + static VERSION: &str = env!("CARGO_PKG_VERSION"); const PEEK_BUFFER_SIZE: usize = 4; // utf-8 can be 4 bytes diff --git a/src/uu/od/src/output_info.rs b/src/uu/od/src/output_info.rs index 01e48c002..7107609db 100644 --- a/src/uu/od/src/output_info.rs +++ b/src/uu/od/src/output_info.rs @@ -1,8 +1,9 @@ -use formatteriteminfo::FormatterItemInfo; -use parse_formats::ParsedFormatterItemInfo; use std::cmp; use std::slice::Iter; +use crate::formatteriteminfo::FormatterItemInfo; +use crate::parse_formats::ParsedFormatterItemInfo; + /// Size in bytes of the max datatype. ie set to 16 for 128-bit numbers. const MAX_BYTES_PER_UNIT: usize = 8; diff --git a/src/uu/od/src/parse_formats.rs b/src/uu/od/src/parse_formats.rs index 872e5840c..cc767ac65 100644 --- a/src/uu/od/src/parse_formats.rs +++ b/src/uu/od/src/parse_formats.rs @@ -1,7 +1,7 @@ -use formatteriteminfo::FormatterItemInfo; -use prn_char::*; -use prn_float::*; -use prn_int::*; +use crate::formatteriteminfo::FormatterItemInfo; +use crate::prn_char::*; +use crate::prn_float::*; +use crate::prn_int::*; #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub struct ParsedFormatterItemInfo { diff --git a/src/uu/od/src/partialreader.rs b/src/uu/od/src/partialreader.rs index 265f13dae..e77adcf1a 100644 --- a/src/uu/od/src/partialreader.rs +++ b/src/uu/od/src/partialreader.rs @@ -1,8 +1,9 @@ -use multifilereader::HasError; use std::cmp; use std::io; use std::io::Read; +use crate::multifilereader::HasError; + /// When a large number of bytes must be skipped, it will be read into a /// dynamically allocated buffer. The buffer will be limited to this size. const MAX_SKIP_BUFFER: usize = 64 * 1024; diff --git a/src/uu/od/src/peekreader.rs b/src/uu/od/src/peekreader.rs index be82e1266..77dc6e56c 100644 --- a/src/uu/od/src/peekreader.rs +++ b/src/uu/od/src/peekreader.rs @@ -1,9 +1,10 @@ //! Contains the trait `PeekRead` and type `PeekReader` implementing it. -use multifilereader::HasError; use std::io; use std::io::{Read, Write}; +use crate::multifilereader::HasError; + /// A trait which supplies a function to peek into a stream without /// actually reading it. /// diff --git a/src/uu/od/src/prn_char.rs b/src/uu/od/src/prn_char.rs index fadc2d11b..895055b63 100644 --- a/src/uu/od/src/prn_char.rs +++ b/src/uu/od/src/prn_char.rs @@ -1,6 +1,7 @@ -use formatteriteminfo::*; use std::str::from_utf8; +use crate::formatteriteminfo::*; + pub static FORMAT_ITEM_A: FormatterItemInfo = FormatterItemInfo { byte_size: 1, print_width: 4, diff --git a/src/uu/od/src/prn_float.rs b/src/uu/od/src/prn_float.rs index 109ce041a..422d3285a 100644 --- a/src/uu/od/src/prn_float.rs +++ b/src/uu/od/src/prn_float.rs @@ -1,9 +1,10 @@ -use formatteriteminfo::*; use half::f16; use std::f32; use std::f64; use std::num::FpCategory; +use crate::formatteriteminfo::*; + pub static FORMAT_ITEM_F16: FormatterItemInfo = FormatterItemInfo { byte_size: 2, print_width: 10, diff --git a/src/uu/od/src/prn_int.rs b/src/uu/od/src/prn_int.rs index 0de656117..aa33919b9 100644 --- a/src/uu/od/src/prn_int.rs +++ b/src/uu/od/src/prn_int.rs @@ -1,4 +1,4 @@ -use formatteriteminfo::*; +use crate::formatteriteminfo::*; /// format string to print octal using `int_writer_unsigned` macro_rules! OCT { diff --git a/src/uu/printf/src/memo.rs b/src/uu/printf/src/memo.rs index 5f3eee482..2d6602184 100644 --- a/src/uu/printf/src/memo.rs +++ b/src/uu/printf/src/memo.rs @@ -5,13 +5,14 @@ //! 2. feeds remaining arguments into function //! that prints tokens. -use cli; use itertools::put_back_n; use std::iter::Peekable; use std::slice::Iter; -use tokenize::sub::Sub; -use tokenize::token::{Token, Tokenizer}; -use tokenize::unescaped_text::UnescapedText; + +use crate::cli; +use crate::tokenize::sub::Sub; +use crate::tokenize::token::{Token, Tokenizer}; +use crate::tokenize::unescaped_text::UnescapedText; pub struct Memo { tokens: Vec>, diff --git a/src/uu/printf/src/tokenize/num_format/formatter.rs b/src/uu/printf/src/tokenize/num_format/formatter.rs index f770823de..3b34d1b65 100644 --- a/src/uu/printf/src/tokenize/num_format/formatter.rs +++ b/src/uu/printf/src/tokenize/num_format/formatter.rs @@ -1,11 +1,13 @@ //! Primitives used by num_format and sub_modules. //! never dealt with above (e.g. Sub Tokenizer never uses these) -use super::format_field::FormatField; -use cli; use itertools::{put_back_n, PutBackN}; use std::str::Chars; +use super::format_field::FormatField; + +use crate::cli; + // contains the rough ingredients to final // output for a number, organized together // to allow for easy generalization of output manipulation diff --git a/src/uu/printf/src/tokenize/num_format/num_format.rs b/src/uu/printf/src/tokenize/num_format/num_format.rs index 8b3f245fe..36c95524a 100644 --- a/src/uu/printf/src/tokenize/num_format/num_format.rs +++ b/src/uu/printf/src/tokenize/num_format/num_format.rs @@ -1,5 +1,8 @@ //! handles creating printed output for numeric substitutions +use std::env; +use std::vec::Vec; + use super::format_field::{FieldType, FormatField}; use super::formatter::{Base, FormatPrimitive, Formatter, InPrefix}; use super::formatters::cninetyninehexfloatf::CninetyNineHexFloatf; @@ -7,9 +10,8 @@ use super::formatters::decf::Decf; use super::formatters::floatf::Floatf; use super::formatters::intf::Intf; use super::formatters::scif::Scif; -use cli; -use std::env; -use std::vec::Vec; + +use crate::cli; pub fn warn_expected_numeric(pf_arg: &str) { // important: keep println here not print diff --git a/src/uu/printf/src/tokenize/sub.rs b/src/uu/printf/src/tokenize/sub.rs index 6e460268c..925d3adfc 100644 --- a/src/uu/printf/src/tokenize/sub.rs +++ b/src/uu/printf/src/tokenize/sub.rs @@ -3,11 +3,6 @@ //! it is created by Sub's implementation of the Tokenizer trait //! Subs which have numeric field chars make use of the num_format //! submodule -use super::num_format::format_field::{FieldType, FormatField}; -use super::num_format::num_format; -use super::token; -use super::unescaped_text::UnescapedText; -use cli; use itertools::{put_back_n, PutBackN}; use std::iter::Peekable; use std::process::exit; @@ -15,6 +10,12 @@ use std::slice::Iter; use std::str::Chars; // use std::collections::HashSet; +use super::num_format::format_field::{FieldType, FormatField}; +use super::num_format::num_format; +use super::token; +use super::unescaped_text::UnescapedText; +use crate::cli; + fn err_conv(sofar: &str) { cli::err_msg(&format!("%{}: invalid conversion specification", sofar)); exit(cli::EXIT_ERR); diff --git a/src/uu/printf/src/tokenize/unescaped_text.rs b/src/uu/printf/src/tokenize/unescaped_text.rs index 5c7ee603b..06700e2a5 100644 --- a/src/uu/printf/src/tokenize/unescaped_text.rs +++ b/src/uu/printf/src/tokenize/unescaped_text.rs @@ -3,8 +3,6 @@ //! and escaped character literals (of allowed escapes), //! into an unescaped text byte array -use super::token; -use cli; use itertools::PutBackN; use std::char::from_u32; use std::iter::Peekable; @@ -12,6 +10,10 @@ use std::process::exit; use std::slice::Iter; use std::str::Chars; +use super::token; + +use crate::cli; + pub struct UnescapedText(Vec); impl UnescapedText { fn new() -> UnescapedText { diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index 8cd3fab5a..bff88890d 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -17,7 +17,7 @@ path = "src/stat.rs" [dependencies] getopts = "0.2.18" time = "0.1.40" -uucore = { version="0.0.3", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["entries"] } +uucore = { version="0.0.3", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["entries", "libc"] } uucore_procs = { version="0.0.3", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } [[bin]] diff --git a/src/uu/stat/src/fsext.rs b/src/uu/stat/src/fsext.rs index 3a36c9296..41e5fecb5 100644 --- a/src/uu/stat/src/fsext.rs +++ b/src/uu/stat/src/fsext.rs @@ -6,16 +6,15 @@ // that was distributed with this source code. // -pub use super::uucore::libc; extern crate time; use self::time::Timespec; -pub use libc::{ +use std::time::UNIX_EPOCH; +pub use uucore::libc::{ c_int, mode_t, strerror, S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFLNK, S_IFMT, S_IFREG, S_IFSOCK, S_IRGRP, S_IROTH, S_IRUSR, S_ISGID, S_ISUID, S_ISVTX, S_IWGRP, S_IWOTH, S_IWUSR, S_IXGRP, S_IXOTH, S_IXUSR, }; -use std::time::UNIX_EPOCH; pub trait BirthTime { fn pretty_birth(&self) -> String; @@ -153,7 +152,7 @@ use std::path::Path; target_os = "android", target_os = "freebsd" ))] -use libc::statfs as Sstatfs; +use uucore::libc::statfs as Sstatfs; #[cfg(any( target_os = "openbsd", target_os = "netbsd", @@ -161,7 +160,7 @@ use libc::statfs as Sstatfs; target_os = "bitrig", target_os = "dragonfly" ))] -use libc::statvfs as Sstatfs; +use uucore::libc::statvfs as Sstatfs; #[cfg(any( target_os = "linux", @@ -169,7 +168,7 @@ use libc::statvfs as Sstatfs; target_os = "android", target_os = "freebsd" ))] -use libc::statfs as statfs_fn; +use uucore::libc::statfs as statfs_fn; #[cfg(any( target_os = "openbsd", target_os = "netbsd", @@ -177,7 +176,7 @@ use libc::statfs as statfs_fn; target_os = "bitrig", target_os = "dragonfly" ))] -use libc::statvfs as statfs_fn; +use uucore::libc::statvfs as statfs_fn; pub trait FsMeta { fn fs_type(&self) -> i64; diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 8f34f8df5..7608bf6f1 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -10,7 +10,7 @@ use getopts::Options; #[macro_use] mod fsext; -pub use fsext::*; +pub use crate::fsext::*; #[macro_use] extern crate uucore; diff --git a/src/uu/tr/src/tr.rs b/src/uu/tr/src/tr.rs index 4fe0e9366..dd8f2910f 100644 --- a/src/uu/tr/src/tr.rs +++ b/src/uu/tr/src/tr.rs @@ -15,14 +15,14 @@ extern crate getopts; #[macro_use] extern crate uucore; +mod expand; + use bit_set::BitSet; use fnv::FnvHashMap; use getopts::Options; use std::io::{stdin, stdout, BufRead, BufWriter, Write}; -use expand::ExpandSet; - -mod expand; +use crate::expand::ExpandSet; static NAME: &str = "tr"; static VERSION: &str = env!("CARGO_PKG_VERSION"); diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index d58f643c5..54984e288 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -19,7 +19,7 @@ getopts = "0.2.18" time = "0.1.40" chrono = "0.4" clap = "2.32" -uucore = { version="0.0.3", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["utmpx"] } +uucore = { version="0.0.3", package="uucore", git="https://github.com/uutils/uucore.git", branch="canary", features=["libc", "utmpx"] } uucore_procs = { version="0.0.3", package="uucore_procs", git="https://github.com/uutils/uucore.git", branch="canary" } [[bin]] diff --git a/src/uu/uptime/src/uptime.rs b/src/uu/uptime/src/uptime.rs index e2906a9d6..8c58f9a87 100644 --- a/src/uu/uptime/src/uptime.rs +++ b/src/uu/uptime/src/uptime.rs @@ -28,11 +28,11 @@ in the run queue over the last 1, 5 and 15 minutes."; static OPT_SINCE: &str = "SINCE"; #[cfg(unix)] -use libc::getloadavg; +use uucore::libc::getloadavg; #[cfg(windows)] extern "C" { - fn GetTickCount() -> libc::uint32_t; + fn GetTickCount() -> uucore::libc::uint32_t; } fn get_usage() -> String { @@ -78,7 +78,7 @@ pub fn uumain(args: Vec) -> i32 { #[cfg(unix)] fn print_loadavg() { - use libc::c_double; + use uucore::libc::c_double; let mut avg: [c_double; 3] = [0.0; 3]; let loads: i32 = unsafe { getloadavg(avg.as_mut_ptr(), 3) };