Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
55209c6
cp: use `CreateFileW` to increase legacy windows compatiblity
rivy Dec 8, 2019
95809ae
Add 'windows_legacy' feature to allow build for older windows versions
rivy Dec 8, 2019
74f26a2
maint/build ~ add `cargo make` support
rivy Dec 29, 2019
c22cf21
refactor/polish ~ convert to inclusive range operator syntax (`..=`)
rivy Dec 8, 2019
b4b0ee4
refactor/polish ~ convert to `try!` to `?` syntax
rivy Dec 8, 2019
45a04ce
refactor ~ replace deprecated `trim_{left,right}...` with `trim_{star…
rivy Dec 22, 2019
2f23a2e
maint/cicd ~ allow rust 'beta' failures (Travis CI)
rivy Dec 16, 2019
d0f6f3d
tests/refactor ~ change output test macros to 'actual = expected' format
rivy Dec 17, 2019
25d4fb7
tests/refactor ~ change to use of common code (`TestScenario::...`) f…
rivy Dec 22, 2019
9416709
stat: fix birth/created time transformation
rivy Dec 25, 2019
244bdf3
who: fix ~ remove unneeded/incorrect time format size change
rivy Dec 22, 2019
14c3f3a
tests ~ fix WSL testing
rivy Dec 25, 2019
823fc17
tests/fix ~ (stat) refactor '%w' and '%W' tests due to `stat` limitat…
rivy Dec 24, 2019
b3846bf
tests/fix ~ (stat) remove '%a', '%d', '%f' from file system test form…
rivy Dec 22, 2019
c969bec
refactor ~ remove unneeded mem::uninitialized() code
rivy Dec 22, 2019
1f137c2
refactor/polish ~ fix `cargo clippy` complaints (fatal/cast_ptr_align…
rivy Dec 28, 2019
1f5749e
refactor/polish ~ fix `cargo clippy` complaints (fatal/same if clause)
rivy Dec 20, 2019
6043ac1
refactor/polish ~ fix `cargo clippy` complaints (fatal/temporary_cstr…
rivy Dec 30, 2019
181c9d6
refactor/polish ~ fix `cargo clippy` complaints (fatal/unneeded clone)
rivy Dec 20, 2019
662db61
refactor/polish ~ fix `cargo clippy` complaints (fatal/unneeded drop)
rivy Dec 20, 2019
a9b1a03
refactor/polish ~ fix `cargo clippy` complaints (fatal/write_all)
rivy Dec 21, 2019
b276f47
refactor/polish ~ fix `cargo clippy` complaints (iter.collect => to_vec)
rivy Dec 28, 2019
768ed71
refactor/polish ~ fix `cargo clippy` complaints (use b'...' notation)
rivy Dec 28, 2019
493f5f1
refactor/polish ~ fix `cargo clippy` complaints (use `+=`/`-=` notation)
rivy Dec 28, 2019
ba5a243
refactor/polish ~ fix `cargo clippy` complaints (unneeded `_`)
rivy Dec 28, 2019
291d2f5
refactor/polish ~ fix `cargo clippy` complaints ('better' as `println…
rivy Dec 28, 2019
413c64f
refactor/polish ~ fix `cargo clippy` complaints ('better' as `println…
rivy Dec 28, 2019
c6817ae
refactor/polish ~ fix `cargo clippy` complaints (or_else)
rivy Dec 28, 2019
c6e9808
refactor/polish ~ fix `cargo clippy` complaints (match function signa…
rivy Dec 28, 2019
3c2e609
refactor/polish ~ fix `cargo clippy` complaints (use `values()`)
rivy Dec 28, 2019
88db11a
refactor/polish ~ fix `cargo clippy` complaints (negation instead of …
rivy Dec 27, 2019
1642933
refactor/polish ~ fix `cargo clippy` complaints (if is_none => as_ref…
rivy Dec 27, 2019
90a64a8
refactor/polish ~ fix `cargo clippy` complaints (for in => iter.take)
rivy Dec 27, 2019
2d95cfd
refactor/polish ~ fix `cargo clippy` complaints (remove allow unused_…
rivy Dec 27, 2019
4ddc65f
refactor/polish ~ fix `cargo clippy` complaints (String => str)
rivy Dec 27, 2019
d192ebe
refactor/polish ~ fix `cargo clippy` complaints (unwrap_or_else)
rivy Dec 27, 2019
8142ecf
refactor/polish ~ fix `cargo clippy` complaints (default/tests => `le…
rivy Dec 26, 2019
e676447
refactor/polish ~ fix `cargo clippy` complaints (`while let ... = som…
rivy Dec 26, 2019
3bff709
refactor/polish ~ fix `cargo clippy` complaints (use `starts_with()`)
rivy Dec 26, 2019
25b1f98
refactor/polish ~ fix `cargo clippy` complaints (unneeded `format`)
rivy Dec 28, 2019
bc558f3
refactor/polish ~ fix `cargo clippy` complaints (unneeded `mut`)
rivy Dec 26, 2019
1216378
refactor/polish ~ fix `cargo clippy` complaints (unneeded ref for cop…
rivy Dec 26, 2019
bf63682
refactor/polish ~ fix `cargo clippy` complaints (unneeded parens)
rivy Dec 26, 2019
3da2a69
refactor/polish ~ fix `cargo clippy` complaints (unneeded `String::fr…
rivy Dec 28, 2019
11d68d3
refactor/polish ~ fix `cargo clippy` complaints (number readability)
rivy Dec 26, 2019
ec5ca19
refactor/polish ~ fix `cargo clippy` complaints (char not string)
rivy Dec 26, 2019
a72422f
refactor/polish ~ fix `cargo clippy` complaints (Vec<> => [])
rivy Dec 28, 2019
ea8ed8d
refactor/polish ~ fix `cargo clippy` complaints (&Vec => &[])
rivy Dec 26, 2019
fa8540c
refactor/polish ~ fix `cargo clippy` complaints (DRY struct def)
rivy Dec 26, 2019
2e90c78
refactor/polish ~ fix `cargo clippy` complaints (redundant closure)
rivy Dec 26, 2019
564168c
refactor/polish ~ fix `cargo clippy` complaints (redundant clone)
rivy Dec 29, 2019
88a45a1
refactor/polish ~ fix `cargo clippy` complaints (redundant return)
rivy Dec 26, 2019
94c088f
refactor/polish ~ fix `cargo clippy` complaints (redundant return var…
rivy Dec 28, 2019
ab87a1a
refactor/polish ~ fix `cargo clippy` complaints ('better' ref indirec…
rivy Dec 26, 2019
8c97f0e
refactor/polish ~ fix `cargo clippy` complaints ('better' match indir…
rivy Dec 28, 2019
2db6fb2
refactor/polish ~ fix `cargo clippy` complaints (needless_lifetimes)
rivy Dec 29, 2019
b8eb763
refactor/polish ~ fix `cargo clippy` complaints (collapse else-if)
rivy Dec 26, 2019
b003d55
refactor/polish ~ fix `cargo clippy` complaints (collapse if-if)
rivy Dec 26, 2019
2931c80
refactor/polish ~ fix `cargo clippy` complaints (collapse equal if bl…
rivy Dec 27, 2019
bb15dcf
refactor/polish ~ fix `cargo clippy` complaints (use is_empty / is_none)
rivy Dec 26, 2019
8b18b7c
refactor/polish ~ fix `cargo clippy` complaints (use is_null)
rivy Dec 26, 2019
739c2d5
refactor/polish ~ fix `cargo clippy` complaints (use is_ok)
rivy Dec 26, 2019
600c404
refactor/polish ~ fix `cargo clippy` complaints (map => if let)
rivy Dec 27, 2019
3bddf84
refactor/polish ~ fix `cargo clippy` complaints (match => if let)
rivy Dec 26, 2019
98039f1
refactor/polish ~ fix `cargo clippy` complaints (String => str)
rivy Dec 26, 2019
fd8e5ac
refactor/polish ~ fix `cargo clippy` complaints (loop/match => while …
rivy Dec 26, 2019
82dc40f
refactor/polish ~ fix `cargo clippy` complaints (simplify enum elemen…
rivy Dec 21, 2019
55b3e4e
refactor/polish ~ fix `cargo clippy` complaints (simplify enum elemen…
rivy Dec 26, 2019
6612445
refactor/polish ~ fix `cargo clippy` complaints (remove `->()`)
rivy Dec 26, 2019
d343d53
refactor/polish ~ fix `cargo clippy` complaints (avoid `as ...`)
rivy Dec 26, 2019
33e5d8c
refactor/polish ~ fix `cargo clippy` complaints (into_iter => iter)
rivy Dec 26, 2019
de9d702
refactor/polish ~ fix `cargo clippy` complaints (use enumerate)
rivy Dec 26, 2019
f933c60
refactor/polish ~ fix `cargo clippy` complaints (filter_map => filter)
rivy Dec 26, 2019
aa2ed76
refactor/polish ~ fix `cargo clippy` complaints (unneeded transmute)
rivy Dec 26, 2019
3344060
refactor/polish ~ fix `cargo clippy` complaints (remove useless lint …
rivy Dec 28, 2019
8ec50b7
refactor/polish ~ fix `cargo clippy` complaints (inefficient `to_stri…
rivy Dec 29, 2019
7cc3571
refactor/polish ~ fix `cargo clippy` complaints (remove unit value as…
rivy Dec 29, 2019
2ef9c9a
refactor/polish ~ fix `cargo clippy` complaints (unnecessary_unwrap)
rivy Dec 29, 2019
248dfba
refactor/polish ~ fix `cargo clippy` complaints (comparison_chain)
rivy Dec 29, 2019
bffea95
refactor/polish ~ fix `cargo clippy` complaints (zero_ptr)
rivy Dec 29, 2019
37a3db1
refactor/polish ~ fix `cargo clippy` complaints (flat_map_identity)
rivy Dec 29, 2019
8f2cdcf
refactor/polish ~ fix `cargo clippy` complaints (trivially_copy_pass_…
rivy Dec 29, 2019
6131f6f
refactor/polish ~ fix `cargo clippy` complaints (borrowed_box)
rivy Dec 29, 2019
1deac8d
refactor/polish ~ fix `cargo clippy` complaints (new_ret_no_self)
rivy Dec 29, 2019
58779be
refactor/polish ~ fix `cargo clippy` complaints (transmute_ptr_to_ptr)
rivy Dec 29, 2019
37c9b0e
refactor/polish ~ fix `cargo clippy` complaints ('better' ref use/top…
rivy Dec 27, 2019
5094d6f
refactor/polish ~ fix `cargo clippy` complaints (allow complexity)
rivy Dec 26, 2019
784887c
refactor/polish ~ fix `cargo clippy` complaints (allow comparison_chain)
rivy Dec 29, 2019
5241eca
refactor/polish ~ fix `cargo clippy` complaints (allow comparison_cha…
rivy Dec 29, 2019
a90e1ab
refactor/polish ~ fix `cargo clippy` complaints (allow enum_variant_n…
rivy Dec 26, 2019
44a60f7
refactor/polish ~ fix `cargo clippy` complaints (allow 'let_and_return')
rivy Dec 26, 2019
99ce03f
refactor/polish ~ fix `cargo clippy` complaints (allow many_single_ch…
rivy Dec 26, 2019
df68c39
refactor/polish ~ fix `cargo clippy` complaints (allow map_clone)
rivy Dec 29, 2019
cc49983
refactor/polish ~ fix `cargo clippy` complaints (allow missing_safety…
rivy Dec 30, 2019
e80970c
refactor/polish ~ fix `cargo clippy` complaints (allow module_inception)
rivy Dec 28, 2019
b8c0711
refactor/polish ~ fix `cargo clippy` complaints (allow ptr_arg)
rivy Dec 30, 2019
522d3ae
refactor/polish ~ fix `cargo clippy` complaints (allow ptr_arg)
rivy Dec 30, 2019
6230ab3
refactor/polish ~ fix `cargo clippy` complaints (allow range_plus_one…
rivy Dec 29, 2019
6c7c478
refactor/polish ~ fix `cargo clippy` complaints (allow single_match)
rivy Dec 26, 2019
372ddf9
refactor/polish ~ fix `cargo clippy` complaints (allow too_many_args)
rivy Dec 26, 2019
d82a170
refactor/polish ~ fix `cargo clippy` complaints (allow unreadable_lit…
rivy Dec 26, 2019
082f952
refactor/polish ~ fix `cargo clippy` complaints (allow useless_let_if…
rivy Dec 30, 2019
a6bdad3
refactor/polish ~ fix `cargo clippy` complaints (allow deprecated mem…
rivy Dec 30, 2019
b4866af
refactor/polish ~ fix `cargo clippy` complaints (deprecated uint64_t)
rivy Dec 31, 2019
daecc56
refactor/polish ~ fix `cargo clippy` complaints (unwrap_or_else)
rivy Dec 31, 2019
15722e3
refactor/polish ~ fix `cargo clippy` complaints (unused imports)
rivy Jan 28, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:

matrix:
allow_failures:
- rust: beta
- rust: nightly
fast_finish: true
include:
Expand Down
9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ unix = [
"generic"
]
windows = ["generic"]
windows_legacy = [
"arch",
"nproc",
"sync",
"touch",
"whoami",

"redox_generic"
]
# Feature "fuchsia" contains the exclusive list of utilities
# that can be compiled and run on Fuchsia. Should be built
# with --no-default-features when selecting this feature.
Expand Down
91 changes: 91 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
[config]
default_to_workspace = false

[config.modify_core_tasks]
namespace = "core"

[env]
CARGO_MAKE_CARGO_BUILD_TEST_FLAGS = { source = "${CARGO_MAKE_RUST_TARGET_OS}", default_value = "", mapping = { "linux" = "--no-default-features --features unix", "windows" = "--no-default-features --features windows" } }

[tasks.default]
description = "Build and Test"
category = "[project]"
dependencies = [
"build",
"test-terse",
]

[tasks.build]
description = "Build"
category = "[project]"
dependencies = [
"core::pre-build",
"core::build",
"core::post-build",
]

[tasks.format]
description = "Format"
category = "[project]"
dependencies = [
"action.format",
]

[tasks.help]
description = "Help"
category = "[project]"
command = "cargo"
args = [ "make", "--list-all-steps" ]

[tasks.lint]
description = "Lint report"
category = "[project]"
dependencies = [
"action-clippy",
"action-fmt_report",
]

[tasks.test]
description = "Test"
category = "[project]"
dependencies = [
"core::pre-test",
"core::test",
"core::post-test",
]

[tasks.test-terse]
description = "Test (with terse/summary output)"
category = "[project]"
dependencies = [
"core::pre-test",
"action-test_quiet",
"core::post-test",
]

### actions

[tasks.action-clippy]
description = "`cargo clippy` lint report"
command = "cargo"
args = ["clippy", "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )"]

[tasks.action-format]
description = "`cargo fmt`"
command = "cargo"
args = ["fmt"]

[tasks.action-fmt]
description = "`cargo fmt`"
command = "cargo"
args = ["fmt"]

[tasks.action-fmt_report]
description = "`cargo fmt` lint report"
command = "cargo"
args = ["fmt", "--", "--check"]

[tasks.action-test_quiet]
description = "Test (in `--quiet` mode)"
command = "cargo"
args = ["test", "--quiet", "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )"]
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn main() {
if val == "1" && key.starts_with(feature_prefix) {
let krate = key[feature_prefix.len()..].to_lowercase();
match krate.as_ref() {
"default" | "unix" | "redox" | "redox_generic" | "fuchsia" | "generic" | "windows"
"default" | "unix" | "redox" | "redox_generic" | "fuchsia" | "generic" | "windows" | "windows_legacy"
| "nightly" | "test_unimplemented" => continue,
_ => {}
}
Expand Down
26 changes: 13 additions & 13 deletions src/cat/cat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ static LONG_HELP: &str = "";

#[derive(PartialEq)]
enum NumberingMode {
NumberNone,
NumberNonEmpty,
NumberAll,
None,
NonEmpty,
All,
}

quick_error! {
Expand Down Expand Up @@ -147,11 +147,11 @@ pub fn uumain(args: Vec<String>) -> i32 {
.parse(args);

let number_mode = if matches.opt_present("b") {
NumberingMode::NumberNonEmpty
NumberingMode::NonEmpty
} else if matches.opt_present("n") {
NumberingMode::NumberAll
NumberingMode::All
} else {
NumberingMode::NumberNone
NumberingMode::None
};

let show_nonprint = matches.opts_present(&[
Expand All @@ -169,7 +169,7 @@ pub fn uumain(args: Vec<String>) -> i32 {
}

let can_write_fast = !(show_tabs || show_nonprint || show_ends || squeeze_blank
|| number_mode != NumberingMode::NumberNone);
|| number_mode != NumberingMode::None);

let success = if can_write_fast {
write_fast(files).is_ok()
Expand Down Expand Up @@ -357,7 +357,7 @@ fn write_file_lines(file: &str, options: &OutputOptions, state: &mut OutputState
if in_buf[pos] == b'\n' {
if !state.at_line_start || !options.squeeze_blank || !one_blank_kept {
one_blank_kept = true;
if state.at_line_start && options.number == NumberingMode::NumberAll {
if state.at_line_start && options.number == NumberingMode::All {
write!(&mut writer, "{0:6}\t", state.line_number)?;
state.line_number += 1;
}
Expand All @@ -371,7 +371,7 @@ fn write_file_lines(file: &str, options: &OutputOptions, state: &mut OutputState
continue;
}
one_blank_kept = false;
if state.at_line_start && options.number != NumberingMode::NumberNone {
if state.at_line_start && options.number != NumberingMode::None {
write!(&mut writer, "{0:6}\t", state.line_number)?;
state.line_number += 1;
}
Expand Down Expand Up @@ -452,11 +452,11 @@ fn write_nonprint_to_end<W: Write>(in_buf: &[u8], writer: &mut W, tab: &[u8]) ->
}
match byte {
9 => writer.write_all(tab),
0...8 | 10...31 => writer.write_all(&[b'^', byte + 64]),
32...126 => writer.write_all(&[byte]),
0..=8 | 10..=31 => writer.write_all(&[b'^', byte + 64]),
32..=126 => writer.write_all(&[byte]),
127 => writer.write_all(&[b'^', byte - 64]),
128...159 => writer.write_all(&[b'M', b'-', b'^', byte - 64]),
160...254 => writer.write_all(&[b'M', b'-', byte - 128]),
128..=159 => writer.write_all(&[b'M', b'-', b'^', byte - 64]),
160..=254 => writer.write_all(&[b'M', b'-', byte - 128]),
_ => writer.write_all(&[b'M', b'-', b'^', 63]),
}.unwrap();
count += 1;
Expand Down
2 changes: 1 addition & 1 deletion src/chmod/chmod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ fn sanitize_input(args: &mut Vec<String>) -> Option<String> {
}
if let Some(second) = args[i].chars().nth(1) {
match second {
'r' | 'w' | 'x' | 'X' | 's' | 't' | 'u' | 'g' | 'o' | '0'...'7' => {
'r' | 'w' | 'x' | 'X' | 's' | 't' | 'u' | 'g' | 'o' | '0'..='7' => {
return Some(args.remove(i));
}
_ => {}
Expand Down
4 changes: 2 additions & 2 deletions src/chown/chown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,8 @@ impl Chowner {
fn wrap_chown<P: AsRef<Path>>(&self, path: P, meta: &Metadata, follow: bool) -> i32 {
use self::Verbosity::*;
let mut ret = 0;
let dest_uid = self.dest_uid.unwrap_or(meta.uid());
let dest_gid = self.dest_gid.unwrap_or(meta.gid());
let dest_uid = self.dest_uid.unwrap_or_else(|| meta.uid());
let dest_gid = self.dest_gid.unwrap_or_else(|| meta.gid());
let path = path.as_ref();
if let Err(e) = self.chown(path, dest_uid, dest_gid, follow) {
match self.verbosity {
Expand Down
2 changes: 1 addition & 1 deletion src/cksum/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn main() {
let file = File::create(&Path::new(&out_dir).join("crc_table.rs")).unwrap();
write!(
&file,
"const CRC_TABLE: [u32; {}] = {:?};",
"#[allow(clippy::unreadable_literal)]\nconst CRC_TABLE: [u32; {}] = {:?};",
CRC_TABLE_LEN, table
).unwrap();
}
Expand Down
8 changes: 0 additions & 8 deletions src/cksum/cksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ extern crate uucore;

use std::fs::File;
use std::io::{self, stdin, BufReader, Read};
#[cfg(not(windows))]
use std::mem;
use std::path::Path;

include!(concat!(env!("OUT_DIR"), "/crc_table.rs"));
Expand All @@ -39,16 +37,10 @@ fn crc_final(mut crc: u32, mut length: usize) -> u32 {
!crc
}

#[cfg(windows)]
fn init_byte_array() -> Vec<u8> {
vec![0; 1024 * 1024]
}

#[cfg(not(windows))]
fn init_byte_array() -> [u8; 1024 * 1024] {
unsafe { mem::uninitialized() }
}

#[inline]
fn cksum(fname: &str) -> io::Result<(u32, usize)> {
let mut crc = 0u32;
Expand Down
2 changes: 1 addition & 1 deletion src/comm/comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static LONG_HELP: &str = "";
fn mkdelim(col: usize, opts: &getopts::Matches) -> String {
let mut s = String::new();
let delim = match opts.opt_str("output-delimiter") {
Some(d) => d.clone(),
Some(d) => d,
None => "\t".to_owned(),
};

Expand Down
Loading