Skip to content

Commit

Permalink
fix: various build warnings on windows build (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
reubeno authored Jul 16, 2024
1 parent b2cb02a commit a050cc2
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions brush-core/src/builtins/trap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ impl builtins::Command for TrapCommand {

#[allow(unused_variables)]
impl TrapCommand {
#[allow(clippy::unnecessary_wraps)]
fn display_signals(context: &commands::ExecutionContext<'_>) -> Result<(), error::Error> {
#[cfg(unix)]
for signal in nix::sys::signal::Signal::iterator() {
Expand Down
2 changes: 1 addition & 1 deletion brush-core/src/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ fn get_completions_using_basic_lookup(shell: &Shell, context: &Context) -> Answe
{
candidates = candidates
.into_iter()
.map(|c| c.replace("\\", "/"))
.map(|c| c.replace('\\', "/"))
.collect();
}

Expand Down
1 change: 1 addition & 0 deletions brush-core/src/interp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ impl Execute for ast::Pipeline {
let mut pids = vec![];

while let Some(child) = spawn_results.pop_front() {
#[allow(clippy::ignored_unit_patterns)]
match child {
SpawnResult::SpawnedChild(child) => {
if let Some(pid) = child.id() {
Expand Down
6 changes: 6 additions & 0 deletions brush-core/src/sys/stubs.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#![allow(dead_code)]
#![allow(clippy::needless_pass_by_value)]
#![allow(clippy::unused_async)]
#![allow(clippy::unused_self)]
#![allow(clippy::unnecessary_wraps)]

pub(crate) mod fs;
pub(crate) mod network;
pub(crate) mod pipes;
Expand Down
2 changes: 1 addition & 1 deletion brush-core/src/sys/windows.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub(crate) use crate::sys::os_pipe as pipes;
pub(crate) use crate::sys::stubs::fs;
pub(crate) use crate::sys::stubs::network;
pub(crate) mod network;

pub(crate) mod signal {
pub(crate) use crate::sys::stubs::signal::*;
Expand Down
5 changes: 4 additions & 1 deletion brush-core/src/sys/windows/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ pub(crate) fn get_effective_gid() -> Result<u32, error::Error> {
}

pub(crate) fn get_current_username() -> Result<String, error::Error> {
Ok(whoami::username())
let username = whoami::fallible::username()?;
Ok(username)
}

#[allow(clippy::unnecessary_wraps)]
pub(crate) fn get_all_users() -> Result<Vec<String>, error::Error> {
// TODO: implement some version of this for Windows
Ok(vec![])
}

#[allow(clippy::unnecessary_wraps)]
pub(crate) fn get_all_groups() -> Result<Vec<String>, error::Error> {
// TODO: implement some version of this for Windows
Ok(vec![])
Expand Down
4 changes: 2 additions & 2 deletions fuzz/fuzz_targets/fuzz_parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ fuzz_target!(|input: String| {
// Ignore known problematic cases without actually running them.
if input.is_empty()
|| input.contains(|c: char| c.is_ascii_control() || !c.is_ascii()) // non-ascii chars (or control sequences)
|| input.contains("!") // history expansions
|| (input.contains("[") && !input.contains("]")) // ???
|| input.contains('!') // history expansions
|| (input.contains('[') && !input.contains(']')) // ???
|| input.contains("<<") // weirdness with here docs
|| input.ends_with('\\') // unterminated trailing escape char?
|| input.contains("|&")
Expand Down

0 comments on commit a050cc2

Please sign in to comment.