diff --git a/src/uu/sed/src/main.rs b/src/uu/sed/src/main.rs index 9b196ed9..e8162660 100644 --- a/src/uu/sed/src/main.rs +++ b/src/uu/sed/src/main.rs @@ -1 +1 @@ -uucore::bin!(uu_free); +uucore::bin!(uu_sed); diff --git a/src/uu/sed/src/sed.rs b/src/uu/sed/src/sed.rs index fa203ab9..7ce66d00 100644 --- a/src/uu/sed/src/sed.rs +++ b/src/uu/sed/src/sed.rs @@ -4,23 +4,20 @@ // file that was distributed with this source code. use clap::{arg, Command}; -use std::{ - fs, - io::{self, BufRead, Write}, - process, -}; -use uucore::{error::UResult, format_usage, help_about, help_usage}; +use uucore::{error::UResult, format_usage}; const ABOUT: &str = "Stream editor for filtering and transforming text"; const USAGE: &str = "sed [-n] script [file...]"; #[uucore::main] pub fn uumain(args: impl uucore::Args) -> UResult<()> { - let matches = uu_app().try_get_matches_from(args)?; + // TODO remove underscore prefix when var is used + let _matches = uu_app().try_get_matches_from(args)?; // TODO Ok(()) } +#[allow(clippy::cognitive_complexity)] pub fn uu_app() -> Command { Command::new(uucore::util_name()) .about(ABOUT) diff --git a/tests/by-util/test_sed.rs b/tests/by-util/test_sed.rs index 05536e19..ec9855a1 100644 --- a/tests/by-util/test_sed.rs +++ b/tests/by-util/test_sed.rs @@ -2,10 +2,6 @@ // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// spell-checker:ignore (words) symdir somefakedir - -use pretty_assertions::assert_eq; -use regex::Regex; use crate::common::util::TestScenario; @@ -16,5 +12,5 @@ fn test_invalid_arg() { #[test] fn test_sed() { - let result = new_ucmd!().succeeds(); + new_ucmd!().succeeds(); } diff --git a/tests/common/util.rs b/tests/common/util.rs index 9f1d6e15..23c559eb 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -5,7 +5,7 @@ //spell-checker: ignore (linux) rlimit prlimit coreutil ggroups uchild uncaptured scmd SHLVL canonicalized -#![allow(dead_code)] +#![allow(dead_code, unexpected_cfgs)] use pretty_assertions::assert_eq; #[cfg(any(target_os = "linux", target_os = "android"))] @@ -25,7 +25,7 @@ use std::os::unix::process::ExitStatusExt; #[cfg(windows)] use std::os::windows::fs::{symlink_dir, symlink_file}; #[cfg(windows)] -use std::path::MAIN_SEPARATOR; +use std::path::MAIN_SEPARATOR_STR; use std::path::{Path, PathBuf}; use std::process::{Child, Command, ExitStatus, Output, Stdio}; use std::rc::Rc; @@ -171,7 +171,7 @@ impl CmdResult { /// Assert `stdout` as bytes with a predicate function returning a `bool`. #[track_caller] - pub fn stdout_check<'a, F>(&'a self, predicate: F) -> &Self + pub fn stdout_check<'a, F>(&'a self, predicate: F) -> &'a Self where F: Fn(&'a [u8]) -> bool, { @@ -186,7 +186,7 @@ impl CmdResult { /// Assert `stdout` as `&str` with a predicate function returning a `bool`. #[track_caller] - pub fn stdout_str_check<'a, F>(&'a self, predicate: F) -> &Self + pub fn stdout_str_check<'a, F>(&'a self, predicate: F) -> &'a Self where F: Fn(&'a str) -> bool, { @@ -201,7 +201,7 @@ impl CmdResult { /// Assert `stderr` as bytes with a predicate function returning a `bool`. #[track_caller] - pub fn stderr_check<'a, F>(&'a self, predicate: F) -> &Self + pub fn stderr_check<'a, F>(&'a self, predicate: F) -> &'a Self where F: Fn(&'a [u8]) -> bool, { @@ -216,7 +216,7 @@ impl CmdResult { /// Assert `stderr` as `&str` with a predicate function returning a `bool`. #[track_caller] - pub fn stderr_str_check<'a, F>(&'a self, predicate: F) -> &Self + pub fn stderr_str_check<'a, F>(&'a self, predicate: F) -> &'a Self where F: Fn(&'a str) -> bool, { @@ -993,7 +993,7 @@ impl AtPath { pub fn relative_symlink_file(&self, original: &str, link: &str) { #[cfg(windows)] - let original = original.replace('/', &MAIN_SEPARATOR.to_string()); + let original = original.replace('/', MAIN_SEPARATOR_STR); log_info( "symlink", format!("{},{}", &original, &self.plus_as_string(link)), @@ -1015,7 +1015,7 @@ impl AtPath { pub fn relative_symlink_dir(&self, original: &str, link: &str) { #[cfg(windows)] - let original = original.replace('/', &MAIN_SEPARATOR.to_string()); + let original = original.replace('/', MAIN_SEPARATOR_STR); log_info( "symlink", format!("{},{}", &original, &self.plus_as_string(link)), @@ -1401,12 +1401,12 @@ impl UCommand { /// /// These __defaults__ are: /// * `bin_path`: Depending on the platform and os, the native shell (unix -> `/bin/sh` etc.). - /// This default also requires to set the first argument to `-c` on unix (`/C` on windows) if - /// this argument wasn't specified explicitly by the user. + /// This default also requires to set the first argument to `-c` on unix (`/C` on windows) if + /// this argument wasn't specified explicitly by the user. /// * `util_name`: `None`. If neither `bin_path` nor `util_name` were given the arguments are - /// run in a shell (See `bin_path` above). + /// run in a shell (See `bin_path` above). /// * `temp_dir`: If `current_dir` was not set, a new temporary directory will be created in - /// which this command will be run and `current_dir` will be set to this `temp_dir`. + /// which this command will be run and `current_dir` will be set to this `temp_dir`. /// * `current_dir`: The temporary directory given by `temp_dir`. /// * `timeout`: `30 seconds` /// * `stdin`: `Stdio::null()`