Skip to content

Commit 0394428

Browse files
authored
chore: deps upgrade and clippy/fmt fix (#283)
1 parent 9a2d536 commit 0394428

File tree

14 files changed

+536
-359
lines changed

14 files changed

+536
-359
lines changed

crates/fspy_preload_unix/src/client/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl Client {
7171
let mut frame = ipc_sender
7272
.claim_frame(frame_size)
7373
.expect("fspy: failed to claim frame in shared memory");
74-
let written_size = encode_into_slice(&path_access, &mut frame, BINCODE_CONFIG)?;
74+
let written_size = encode_into_slice(path_access, &mut frame, BINCODE_CONFIG)?;
7575
assert_eq!(written_size, size_writer.bytes_written);
7676

7777
Ok(())

crates/fspy_shared/src/ipc/channel/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub fn channel(capacity: usize) -> io::Result<(ChannelConf, Receiver)> {
3434
conf = conf.allow_raw(true);
3535
}
3636

37-
let shm = conf.create().map_err(|err| io::Error::new(io::ErrorKind::Other, err))?;
37+
let shm = conf.create().map_err(io::Error::other)?;
3838

3939
let conf = ChannelConf {
4040
lock_file_path: lock_file_path.as_os_str().into(),
@@ -61,7 +61,7 @@ impl ChannelConf {
6161
{
6262
conf = conf.allow_raw(true);
6363
}
64-
let shm = conf.open().map_err(|err| io::Error::new(io::ErrorKind::Other, err))?;
64+
let shm = conf.open().map_err(io::Error::other)?;
6565
let writer = unsafe { ShmWriter::new(shm) };
6666
Ok(Sender { writer, lock_file, lock_file_path: self.lock_file_path.clone() })
6767
}

crates/fspy_shared/src/ipc/channel/shm_io.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn assert_alignment(ptr: *const u8) {
7171
fn roundup_to_align_frame_header(mut size: usize) -> usize {
7272
// round up new_end so that the next frame header is aligned
7373
const FRAME_HEADER_ALIGN: usize = align_of::<AtomicI32>();
74-
if size % FRAME_HEADER_ALIGN != 0 {
74+
if !size.is_multiple_of(FRAME_HEADER_ALIGN) {
7575
size += FRAME_HEADER_ALIGN - (size % FRAME_HEADER_ALIGN);
7676
}
7777
size
@@ -349,7 +349,7 @@ mod tests {
349349
// allocates this many of usize to fit the requested byte size
350350
let size_in_usize = len / size_of::<usize>() + 1;
351351

352-
let mem: Vec<usize> = core::iter::repeat(0usize).take(size_in_usize).collect();
352+
let mem: Vec<usize> = std::iter::repeat_n(0usize, size_in_usize).collect();
353353

354354
Self { mem: Arc::new(mem), len }
355355
}

crates/fspy_shared_unix/src/exec/mod.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,15 @@ impl Exec {
100100
config: ExecResolveConfig,
101101
) -> nix::Result<()> {
102102
if let Some(search_path) = config.search_path {
103-
let path = search_path.custom_path.map_or_else(
104-
|| {
105-
getenv(c"PATH").map_or_else(
106-
|| {
107-
// https://github.com/kraj/musl/blob/1b06420abdf46f7d06ab4067e7c51b8b63731852/src/process/execvp.c#L21
108-
b"/usr/local/bin:/bin:/usr/bin".as_bstr()
109-
},
110-
|path| path.to_bytes().as_bstr(),
111-
)
112-
},
113-
|custom_path| custom_path,
114-
);
103+
let path = search_path.custom_path.unwrap_or_else(|| {
104+
getenv(c"PATH").map_or_else(
105+
|| {
106+
// https://github.com/kraj/musl/blob/1b06420abdf46f7d06ab4067e7c51b8b63731852/src/process/execvp.c#L21
107+
b"/usr/local/bin:/bin:/usr/bin".as_bstr()
108+
},
109+
|path| path.to_bytes().as_bstr(),
110+
)
111+
});
115112
let program = which::which(
116113
self.program.as_ref(),
117114
path,

crates/fspy_test_utils/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,10 @@ pub fn create_command(id: &str, arg: impl Encode) -> Command {
6161
mod tests {
6262
use std::str::from_utf8;
6363

64-
use super::*;
65-
6664
#[test]
6765
fn test_command_executing() {
6866
let mut command = command_executing!(42u32, |arg: u32| {
69-
print!("{}", arg);
67+
print!("{arg}");
7068
});
7169
let output = command.output().unwrap();
7270
assert_eq!(from_utf8(&output.stdout), Ok("42"));

crates/vite_glob/src/error.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use wax;
2-
31
#[derive(Debug, thiserror::Error)]
42
pub enum Error {
53
#[error(transparent)]

crates/vite_path/src/relative.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl RelativePath {
7979
#[derive(
8080
Debug, Encode, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Serialize, Deserialize, Default,
8181
)]
82-
#[allow(clippy::unsafe_derive_deserialize)]
82+
#[expect(clippy::unsafe_derive_deserialize)]
8383
pub struct RelativePathBuf(Str);
8484

8585
impl AsRef<Path> for RelativePathBuf {

crates/vite_task/src/ui.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,8 @@ pub fn get_display_command(display_options: DisplayOptions, task: &ResolvedTask)
3838
};
3939

4040
let cwd = task.resolved_command.fingerprint.cwd.as_str();
41-
Some(format!(
42-
"{}$ {}",
43-
if cwd.is_empty() { format_args!("") } else { format_args!("~/{cwd}") },
44-
display_command
45-
))
41+
let cwd_str = if cwd.is_empty() { format_args!("") } else { format_args!("~/{cwd}") };
42+
Some(format!("{cwd_str}$ {display_command}"))
4643
}
4744

4845
/// Displayed before the task is executed

crates/vite_tui/src/app.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl App {
8585

8686
tokio::spawn({
8787
let action_tx = self.action_tx.clone();
88-
let task = task.to_string();
88+
let task = task.clone();
8989
async move {
9090
// Consume the output from the child
9191
// Can't read the full buffer, since that would wait for EOF

crates/vite_workspace/src/error.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
use std::{io, path::Path};
22

3-
use serde_json;
4-
use serde_yml;
53
use vite_path::{
64
AbsolutePathBuf, RelativePathBuf, absolute::StripPrefixError, relative::InvalidPathDataError,
75
};
86
use vite_str::Str;
9-
use wax;
107

118
#[derive(Debug, thiserror::Error)]
129
pub enum Error {

0 commit comments

Comments
 (0)