Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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: 0 additions & 1 deletion crates/bashkit/src/builtins/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,6 @@ impl Builtin for Gunzip {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/assert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ impl Builtin for Assert {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/awk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3126,7 +3126,6 @@ impl Awk {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use crate::fs::{FileSystem, InMemoryFs};
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/bc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ impl<'a> ExprParser<'a> {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/checksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ fn hex_digest<D: Digest>(data: &[u8]) -> String {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ impl Builtin for Column {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ impl Builtin for Comm {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/compgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ impl Builtin for Compgen {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/csv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ impl Builtin for Csv {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/curl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,6 @@ fn extract_host_from_url(url: &str) -> String {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/cuttr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,6 @@ fn expand_char_set(spec: &str) -> Vec<char> {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ impl Builtin for Date {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ impl Builtin for Diff {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/dirstack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ fn format_stack(ctx: &Context<'_>) -> String {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ impl Builtin for Df {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use crate::fs::{FileSystem, FsLimits, InMemoryFs};
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/dotenv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ impl Builtin for Dotenv {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
8 changes: 4 additions & 4 deletions crates/bashkit/src/builtins/echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ impl Builtin for Echo {
}
}

// to_digit().unwrap() is safe: only called after is_ascii_hexdigit() check
#[allow(clippy::unwrap_used)]
fn interpret_escape_sequences(s: &str) -> String {
let mut result = String::new();
let mut chars = s.chars().peekable();
Expand Down Expand Up @@ -109,7 +107,10 @@ fn interpret_escape_sequences(s: &str) -> String {
for _ in 0..2 {
if let Some(&digit) = chars.peek() {
if digit.is_ascii_hexdigit() {
value = value * 16 + digit.to_digit(16).unwrap() as u8;
value = value * 16
+ digit.to_digit(16).expect(
"to_digit(16) valid: guarded by is_ascii_hexdigit()",
) as u8;
chars.next();
} else {
break;
Expand Down Expand Up @@ -137,7 +138,6 @@ fn interpret_escape_sequences(s: &str) -> String {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;

Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/environ.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ impl Builtin for History {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ fn next_tab_stop(col: usize, tab_stops: &[usize]) -> usize {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use crate::fs::InMemoryFs;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ fn char_matches(c: char, pattern: char) -> bool {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/fc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ impl Builtin for Fc {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
18 changes: 8 additions & 10 deletions crates/bashkit/src/builtins/fileops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ pub struct Cp;

#[async_trait]
impl Builtin for Cp {
// files.last().unwrap() is safe: guarded by files.len() < 2 check above
#[allow(clippy::unwrap_used)]
async fn execute(&self, ctx: Context<'_>) -> Result<ExecResult> {
if ctx.args.len() < 2 {
return Ok(ExecResult::err("cp: missing file operand\n".to_string(), 1));
Expand All @@ -167,7 +165,9 @@ impl Builtin for Cp {
));
}

let dest = files.last().unwrap();
let dest = files
.last()
.expect("files.last() valid: guarded by files.len() < 2 check above");
let sources = &files[..files.len() - 1];
let dest_path = resolve_path(ctx.cwd, dest);

Expand Down Expand Up @@ -218,8 +218,6 @@ pub struct Mv;

#[async_trait]
impl Builtin for Mv {
// files.last().unwrap() is safe: guarded by files.len() < 2 check above
#[allow(clippy::unwrap_used)]
async fn execute(&self, ctx: Context<'_>) -> Result<ExecResult> {
if ctx.args.len() < 2 {
return Ok(ExecResult::err("mv: missing file operand\n".to_string(), 1));
Expand All @@ -234,7 +232,9 @@ impl Builtin for Mv {
));
}

let dest = files.last().unwrap();
let dest = files
.last()
.expect("files.last() valid: guarded by files.len() < 2 check above");
let sources = &files[..files.len() - 1];
let dest_path = resolve_path(ctx.cwd, dest);

Expand Down Expand Up @@ -426,8 +426,6 @@ fn apply_symbolic_mode(mode_str: &str, current_mode: u32) -> Option<u32> {

#[async_trait]
impl Builtin for Chmod {
// from_str_radix().unwrap() is safe: is_ok() check on same value above
#[allow(clippy::unwrap_used)]
async fn execute(&self, ctx: Context<'_>) -> Result<ExecResult> {
if ctx.args.len() < 2 {
return Ok(ExecResult::err("chmod: missing operand\n".to_string(), 1));
Expand All @@ -453,7 +451,8 @@ impl Builtin for Chmod {
}

let mode = if is_octal {
u32::from_str_radix(mode_str, 8).unwrap()
u32::from_str_radix(mode_str, 8)
.expect("from_str_radix valid: is_octal confirmed by is_ok() check above")
} else {
// Symbolic mode - need current permissions
let current_mode = match ctx.fs.stat(&path).await {
Expand Down Expand Up @@ -735,7 +734,6 @@ impl Builtin for Mktemp {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ impl Builtin for Return {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/fold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ fn fold_line(line: &str, width: usize, break_at_spaces: bool, output: &mut Strin
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use crate::fs::InMemoryFs;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/glob_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ impl GlobCmd {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/grep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,6 @@ impl Builtin for Grep {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use crate::fs::{FileSystem, InMemoryFs};
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/headtail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ fn take_last_lines(text: &str, n: usize) -> String {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,6 @@ impl Builtin for Help {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/hextools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,6 @@ async fn collect_input(
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@ async fn execute_http_request(
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/iconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ impl Builtin for Iconv {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/inspect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ fn default_stat_format(name: &str, metadata: &crate::fs::Metadata) -> String {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ async fn read_input(
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use crate::fs::{FileSystem, InMemoryFs};
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/jq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,6 @@ impl Builtin for Jq {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use crate::fs::{FileSystem, InMemoryFs};
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ impl Builtin for Json {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ impl Builtin for Log {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,6 @@ impl Builtin for Rmdir {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/mkfifo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ impl Builtin for Mkfifo {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use crate::fs::{FileSystem, InMemoryFs};
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/nl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ impl Builtin for Nl {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
1 change: 0 additions & 1 deletion crates/bashkit/src/builtins/parallel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ impl Builtin for Parallel {
}

#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use std::collections::HashMap;
Expand Down
Loading
Loading