Skip to content
Merged
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
2 changes: 1 addition & 1 deletion crates/fspy_preload_unix/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl Client {
let mut frame = ipc_sender
.claim_frame(frame_size)
.expect("fspy: failed to claim frame in shared memory");
let written_size = encode_into_slice(&path_access, &mut frame, BINCODE_CONFIG)?;
let written_size = encode_into_slice(path_access, &mut frame, BINCODE_CONFIG)?;
assert_eq!(written_size, size_writer.bytes_written);

Ok(())
Expand Down
4 changes: 2 additions & 2 deletions crates/fspy_shared/src/ipc/channel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub fn channel(capacity: usize) -> io::Result<(ChannelConf, Receiver)> {
conf = conf.allow_raw(true);
}

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

let conf = ChannelConf {
lock_file_path: lock_file_path.as_os_str().into(),
Expand All @@ -61,7 +61,7 @@ impl ChannelConf {
{
conf = conf.allow_raw(true);
}
let shm = conf.open().map_err(|err| io::Error::new(io::ErrorKind::Other, err))?;
let shm = conf.open().map_err(io::Error::other)?;
let writer = unsafe { ShmWriter::new(shm) };
Ok(Sender { writer, lock_file, lock_file_path: self.lock_file_path.clone() })
}
Expand Down
4 changes: 2 additions & 2 deletions crates/fspy_shared/src/ipc/channel/shm_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ fn assert_alignment(ptr: *const u8) {
fn roundup_to_align_frame_header(mut size: usize) -> usize {
// round up new_end so that the next frame header is aligned
const FRAME_HEADER_ALIGN: usize = align_of::<AtomicI32>();
if size % FRAME_HEADER_ALIGN != 0 {
if !size.is_multiple_of(FRAME_HEADER_ALIGN) {
size += FRAME_HEADER_ALIGN - (size % FRAME_HEADER_ALIGN);
}
size
Expand Down Expand Up @@ -349,7 +349,7 @@ mod tests {
// allocates this many of usize to fit the requested byte size
let size_in_usize = len / size_of::<usize>() + 1;

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

Self { mem: Arc::new(mem), len }
}
Expand Down
21 changes: 9 additions & 12 deletions crates/fspy_shared_unix/src/exec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,15 @@ impl Exec {
config: ExecResolveConfig,
) -> nix::Result<()> {
if let Some(search_path) = config.search_path {
let path = search_path.custom_path.map_or_else(
|| {
getenv(c"PATH").map_or_else(
|| {
// https://github.com/kraj/musl/blob/1b06420abdf46f7d06ab4067e7c51b8b63731852/src/process/execvp.c#L21
b"/usr/local/bin:/bin:/usr/bin".as_bstr()
},
|path| path.to_bytes().as_bstr(),
)
},
|custom_path| custom_path,
);
let path = search_path.custom_path.unwrap_or_else(|| {
getenv(c"PATH").map_or_else(
|| {
// https://github.com/kraj/musl/blob/1b06420abdf46f7d06ab4067e7c51b8b63731852/src/process/execvp.c#L21
b"/usr/local/bin:/bin:/usr/bin".as_bstr()
},
|path| path.to_bytes().as_bstr(),
)
});
let program = which::which(
self.program.as_ref(),
path,
Expand Down
4 changes: 1 addition & 3 deletions crates/fspy_test_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,10 @@ pub fn create_command(id: &str, arg: impl Encode) -> Command {
mod tests {
use std::str::from_utf8;

use super::*;

#[test]
fn test_command_executing() {
let mut command = command_executing!(42u32, |arg: u32| {
print!("{}", arg);
print!("{arg}");
});
let output = command.output().unwrap();
assert_eq!(from_utf8(&output.stdout), Ok("42"));
Expand Down
2 changes: 0 additions & 2 deletions crates/vite_glob/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use wax;

#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error(transparent)]
Expand Down
2 changes: 1 addition & 1 deletion crates/vite_path/src/relative.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl RelativePath {
#[derive(
Debug, Encode, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Serialize, Deserialize, Default,
)]
#[allow(clippy::unsafe_derive_deserialize)]
#[expect(clippy::unsafe_derive_deserialize)]
pub struct RelativePathBuf(Str);

impl AsRef<Path> for RelativePathBuf {
Expand Down
7 changes: 2 additions & 5 deletions crates/vite_task/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,8 @@ pub fn get_display_command(display_options: DisplayOptions, task: &ResolvedTask)
};

let cwd = task.resolved_command.fingerprint.cwd.as_str();
Some(format!(
"{}$ {}",
if cwd.is_empty() { format_args!("") } else { format_args!("~/{cwd}") },
display_command
))
Comment on lines -41 to -45
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't expect bumping rust version would break this...🤔

let cwd_str = if cwd.is_empty() { format_args!("") } else { format_args!("~/{cwd}") };
Some(format!("{cwd_str}$ {display_command}"))
Comment thread
Brooooooklyn marked this conversation as resolved.
}

/// Displayed before the task is executed
Expand Down
2 changes: 1 addition & 1 deletion crates/vite_tui/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl App {

tokio::spawn({
let action_tx = self.action_tx.clone();
let task = task.to_string();
let task = task.clone();
async move {
// Consume the output from the child
// Can't read the full buffer, since that would wait for EOF
Expand Down
3 changes: 0 additions & 3 deletions crates/vite_workspace/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
use std::{io, path::Path};

use serde_json;
use serde_yml;
use vite_path::{
AbsolutePathBuf, RelativePathBuf, absolute::StripPrefixError, relative::InvalidPathDataError,
};
use vite_str::Str;
use wax;

#[derive(Debug, thiserror::Error)]
pub enum Error {
Expand Down
2 changes: 1 addition & 1 deletion crates/vite_workspace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ mod tests {
if let Err(Error::DuplicatedPackageName { name, .. }) = result {
assert_eq!(name, "duplicate");
} else {
panic!("Expected DuplicatedPackageName error, got: {:?}", result);
panic!("Expected DuplicatedPackageName error, got: {result:?}");
}
}

Expand Down
Loading
Loading