diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c9a50cd1e..2a8a80315 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,9 +4,10 @@ Contributions are very welcome, and should target Rust's master branch until the standard libraries are stabilized. You may *claim* an item on the to-do list by following these steps: -1. Open an issue named "Implement [the utility of your choice]", e.g. "Implement ls" +1. Open an issue named "Implement [the utility of your choice]", e.g. "Implement + ls". 1. State that you are working on this utility. -1. Develop the utility +1. Develop the utility. 1. Add integration tests. 1. Add the reference to your utility into Cargo.toml and Makefile. 1. Remove utility from the to-do list in the README. @@ -17,12 +18,20 @@ search the issues to make sure no one else is working on it. ## Best practices -1. Follow what GNU is doing in terms of options and behavior. It is recommended to look at the GNU Coreutils manual ([on the web](https://www.gnu.org/software/coreutils/manual/html_node/index.html), or locally using `info `). It is more in depth than the man pages and provides a good description of available features and their implementation details. -1. If possible, look at the GNU test suite execution in the CI and make the test work if failing. +1. Follow what GNU is doing in terms of options and behavior. It is recommended + to look at the GNU Coreutils manual ([on the + web](https://www.gnu.org/software/coreutils/manual/html_node/index.html), or + locally using `info `). It is more in depth than the man pages and + provides a good description of available features and their implementation + details. +1. If possible, look at the GNU test suite execution in the CI and make the test + work if failing. 1. Use clap for argument management. -1. Make sure that the code coverage is covering all of the cases, including errors. +1. Make sure that the code coverage is covering all of the cases, including + errors. 1. The code must be clippy-warning-free and rustfmt-compliant. -1. Don't hesitate to move common functions into uucore if they can be reused by other binaries. +1. Don't hesitate to move common functions into uucore if they can be reused by + other binaries. 1. Unsafe code should be documented with Safety comments. 1. uutils is original code. It cannot contain code from existing GNU or Unix-like utilities, nor should it link to or reference GNU libraries. @@ -99,9 +108,11 @@ project, a tool like `cargo-license` can be used to show their license details. The following types of license are acceptable: * MIT License -* Dual- or tri-license with an MIT License option ("Apache-2.0 or MIT" is a popular combination) +* Dual- or tri-license with an MIT License option ("Apache-2.0 or MIT" is a + popular combination) * "MIT equivalent" license (2-clause BSD, 3-clause BSD, ISC) * License less restrictive than the MIT License (CC0 1.0 Universal) +* Apache License version 2.0 Licenses we will not use: diff --git a/src/uu/arch/src/arch.rs b/src/uu/arch/src/arch.rs index ef12eb82a..94ec97e98 100644 --- a/src/uu/arch/src/arch.rs +++ b/src/uu/arch/src/arch.rs @@ -6,9 +6,6 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index 8ad563c5d..35a5308ed 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -10,9 +10,6 @@ // spell-checker:ignore (ToDO) nonprint nonblank nonprinting -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[cfg(unix)] extern crate unix_socket; #[macro_use] diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 91ea7ef37..7c67649c2 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -55,7 +55,6 @@ use walkdir::WalkDir; use std::os::unix::fs::PermissionsExt; #[cfg(target_os = "linux")] -#[allow(clippy::missing_safety_doc)] ioctl!(write ficlone with 0x94, 9; std::os::raw::c_int); quick_error! { diff --git a/src/uu/csplit/src/csplit_error.rs b/src/uu/csplit/src/csplit_error.rs index e2f514ea9..637cf8890 100644 --- a/src/uu/csplit/src/csplit_error.rs +++ b/src/uu/csplit/src/csplit_error.rs @@ -1,6 +1,3 @@ -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - use std::io; use thiserror::Error; diff --git a/src/uu/dirname/src/dirname.rs b/src/uu/dirname/src/dirname.rs index 8d85dc85e..63ee57272 100644 --- a/src/uu/dirname/src/dirname.rs +++ b/src/uu/dirname/src/dirname.rs @@ -5,9 +5,6 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 61a3b8c29..9c05eb982 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -5,9 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/echo/src/echo.rs b/src/uu/echo/src/echo.rs index acdd22948..aae1ad10d 100644 --- a/src/uu/echo/src/echo.rs +++ b/src/uu/echo/src/echo.rs @@ -6,9 +6,6 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/false/src/false.rs b/src/uu/false/src/false.rs index 232431142..2d64c8376 100644 --- a/src/uu/false/src/false.rs +++ b/src/uu/false/src/false.rs @@ -5,9 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/hostid/src/hostid.rs b/src/uu/hostid/src/hostid.rs index 180c4d2e5..b0f68968d 100644 --- a/src/uu/hostid/src/hostid.rs +++ b/src/uu/hostid/src/hostid.rs @@ -7,9 +7,6 @@ // spell-checker:ignore (ToDO) gethostid -// Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/hostname/src/hostname.rs b/src/uu/hostname/src/hostname.rs index 14f8b9df2..045e43045 100644 --- a/src/uu/hostname/src/hostname.rs +++ b/src/uu/hostname/src/hostname.rs @@ -7,9 +7,6 @@ // spell-checker:ignore (ToDO) MAKEWORD addrs hashset -// Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/kill/src/kill.rs b/src/uu/kill/src/kill.rs index 88eb08fa7..b3f5010ca 100644 --- a/src/uu/kill/src/kill.rs +++ b/src/uu/kill/src/kill.rs @@ -7,9 +7,6 @@ // spell-checker:ignore (ToDO) signalname pids -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index a2c6f3481..8fcd34bed 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -7,9 +7,6 @@ // spell-checker:ignore (ToDO) cpio svgz webm somegroup nlink rmvb xspf -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; #[cfg(unix)] diff --git a/src/uu/mkdir/src/mkdir.rs b/src/uu/mkdir/src/mkdir.rs index 7362601ba..a99867570 100644 --- a/src/uu/mkdir/src/mkdir.rs +++ b/src/uu/mkdir/src/mkdir.rs @@ -5,9 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/mktemp/src/mktemp.rs b/src/uu/mktemp/src/mktemp.rs index ef5c41abf..8a4b472aa 100644 --- a/src/uu/mktemp/src/mktemp.rs +++ b/src/uu/mktemp/src/mktemp.rs @@ -8,9 +8,6 @@ // spell-checker:ignore (paths) GPGHome -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/pathchk/src/pathchk.rs b/src/uu/pathchk/src/pathchk.rs index 335266456..7f728667f 100644 --- a/src/uu/pathchk/src/pathchk.rs +++ b/src/uu/pathchk/src/pathchk.rs @@ -170,7 +170,7 @@ fn check_basic(path: &[String]) -> bool { fn check_extra(path: &[String]) -> bool { // components: leading hyphens for p in path { - if !no_leading_hyphen(p) { + if p.starts_with('-') { writeln!( &mut std::io::stderr(), "leading hyphen in file name component '{}'", @@ -236,11 +236,6 @@ fn check_searchable(path: &str) -> bool { } } -// check for a hyphen at the beginning of a path segment -fn no_leading_hyphen(path_segment: &str) -> bool { - !path_segment.starts_with('-') -} - // check whether a path segment contains only valid (read: portable) characters fn check_portable_chars(path_segment: &str) -> bool { const VALID_CHARS: &[u8] = b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-"; diff --git a/src/uu/pwd/src/pwd.rs b/src/uu/pwd/src/pwd.rs index c72cc64e2..37effe618 100644 --- a/src/uu/pwd/src/pwd.rs +++ b/src/uu/pwd/src/pwd.rs @@ -5,9 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/sleep/src/sleep.rs b/src/uu/sleep/src/sleep.rs index 1cb858a34..127804a9f 100644 --- a/src/uu/sleep/src/sleep.rs +++ b/src/uu/sleep/src/sleep.rs @@ -5,9 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index bfc7a4197..dd2b05d0e 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -8,9 +8,6 @@ // spell-checker:ignore (ToDO) filetime strptime utcoff strs datetime MMDDhhmm -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - pub extern crate filetime; #[macro_use] diff --git a/src/uu/true/src/true.rs b/src/uu/true/src/true.rs index e6b7b9025..f84a89176 100644 --- a/src/uu/true/src/true.rs +++ b/src/uu/true/src/true.rs @@ -5,9 +5,6 @@ // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - #[macro_use] extern crate uucore; diff --git a/src/uu/wc/src/wc.rs b/src/uu/wc/src/wc.rs index 95d71e77a..0bcc66664 100644 --- a/src/uu/wc/src/wc.rs +++ b/src/uu/wc/src/wc.rs @@ -4,8 +4,6 @@ // * // * For the full copyright and license information, please view the LICENSE // * file that was distributed with this source code. -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] #[macro_use] extern crate uucore; diff --git a/src/uucore/src/lib/features/encoding.rs b/src/uucore/src/lib/features/encoding.rs index 08c0d27e9..03fa0ed8b 100644 --- a/src/uucore/src/lib/features/encoding.rs +++ b/src/uucore/src/lib/features/encoding.rs @@ -7,9 +7,6 @@ // spell-checker:ignore (strings) ABCDEFGHIJKLMNOPQRSTUVWXYZ -// clippy bug https://github.com/rust-lang/rust-clippy/issues/7422 -#![allow(clippy::nonstandard_macro_braces)] - extern crate data_encoding; use self::data_encoding::{DecodeError, BASE32, BASE64};