Skip to content

Commit

Permalink
Stable rust patch
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Saveau <[email protected]>
  • Loading branch information
SUPERCILEX committed Jul 1, 2024
1 parent 2d61845 commit 4a02419
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 16 deletions.
8 changes: 5 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ members = [
]

[workspace.package]
version = "1.1.6"
version = "2.0.0"
authors = ["Alex Saveau <[email protected]>"]
edition = "2021"
repository = "https://github.com/SUPERCILEX/fuc"
license = "Apache-2.0"
rust-version = "1.79"

[package]
name = "lint"
Expand Down
4 changes: 3 additions & 1 deletion cpz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ repository.workspace = true
keywords = ["tools", "files", "cp"]
categories = ["command-line-utilities", "development-tools", "filesystem"]
license.workspace = true
rust-version.workspace = true

[dependencies]
clap = { version = "4.5.8", features = ["derive", "wrap_help"] }
error-stack = "0.4.1"
fuc_engine = { version = "1", path = "../fuc_engine" }
fuc_engine = { version = "2", path = "../fuc_engine" }
once_cell = "1.18.0"
indicatif = { version = "0.17.8", optional = true }
thiserror = "1.0.61"
tracing = { version = "0.1.40", optional = true }
Expand Down
10 changes: 5 additions & 5 deletions cpz/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#![feature(let_chains)]

use std::{
cell::LazyCell,
fs,
mem::swap,
path::{PathBuf, MAIN_SEPARATOR, MAIN_SEPARATOR_STR},
Expand All @@ -10,6 +7,7 @@ use std::{
use clap::{ArgAction, Parser, ValueHint};
use error_stack::Report;
use fuc_engine::{CopyOp, Error};
use once_cell::sync::Lazy as LazyCell;

/// A zippy alternative to `cp`, a tool to copy files and directories
#[derive(Parser, Debug)]
Expand Down Expand Up @@ -260,8 +258,10 @@ fn copy(
let to = {
let is_into_directory = *is_into_directory;
let mut to = to;
if is_into_directory && let Some(name) = from.file_name() {
to.push(name);
if is_into_directory {
if let Some(name) = from.file_name() {
to.push(name);
}
}
to
};
Expand Down
2 changes: 2 additions & 0 deletions fuc_engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ repository.workspace = true
keywords = ["tools", "files"]
categories = ["filesystem"]
license.workspace = true
rust-version.workspace = true

[dependencies]
crossbeam-channel = "0.5.13"
once_cell = "1.18.0"
thiserror = "1.0.61"
tracing = { version = "0.1.40", default-features = false, features = ["attributes"], optional = true }
typed-builder = "0.18.2"
Expand Down
1 change: 0 additions & 1 deletion fuc_engine/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(lazy_cell_consume)]
#![allow(clippy::used_underscore_binding)]
#![allow(clippy::needless_pass_by_value)]

Expand Down
5 changes: 3 additions & 2 deletions fuc_engine/src/ops/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ fn schedule_copies<
mod compat {
use std::{
borrow::Cow,
cell::{Cell, LazyCell},
cell::Cell,
env,
ffi::{CStr, CString},
fmt::{Debug, Formatter},
Expand All @@ -155,6 +155,7 @@ mod compat {
};

use crossbeam_channel::{Receiver, Sender};
use once_cell::sync::Lazy as LazyCell;
use rustix::{
fs::{
copy_file_range, mkdirat, openat, readlinkat, statx, symlinkat, AtFlags, FileType,
Expand Down Expand Up @@ -210,7 +211,7 @@ mod compat {
fn finish(self) -> Result<(), Error> {
let Self { scheduling } = self;

if let Ok((tasks, thread)) = LazyCell::into_inner(scheduling) {
if let Ok((tasks, thread)) = LazyCell::into_value(scheduling) {
drop(tasks);
thread.join().map_err(|_| Error::Join)??;
}
Expand Down
4 changes: 2 additions & 2 deletions fuc_engine/src/ops/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ fn schedule_deletions<'a, I: Into<Cow<'a, Path>>, F: IntoIterator<Item = I>>(
mod compat {
use std::{
borrow::Cow,
cell::LazyCell,
env,
env::{current_dir, set_current_dir},
ffi::{CStr, CString, OsStr},
Expand All @@ -135,6 +134,7 @@ mod compat {
};

use crossbeam_channel::{Receiver, Sender};
use once_cell::sync::Lazy as LazyCell;
use rustix::{
fs::{openat, unlinkat, AtFlags, FileType, Mode, OFlags, RawDir, CWD},
thread::{unshare, UnshareFlags},
Expand Down Expand Up @@ -183,7 +183,7 @@ mod compat {
fn finish(self) -> Result<(), Error> {
let Self { scheduling } = self;

if let Ok((tasks, thread)) = LazyCell::into_inner(scheduling) {
if let Ok((tasks, thread)) = LazyCell::into_value(scheduling) {
drop(tasks);
thread.join().map_err(|_| Error::Join)??;
}
Expand Down
3 changes: 2 additions & 1 deletion rmz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ repository.workspace = true
keywords = ["tools", "files", "rm"]
categories = ["command-line-utilities", "development-tools", "filesystem"]
license.workspace = true
rust-version.workspace = true

[dependencies]
clap = { version = "4.5.8", features = ["derive", "wrap_help"] }
error-stack = "0.4.1"
fuc_engine = { version = "1", path = "../fuc_engine" }
fuc_engine = { version = "2", path = "../fuc_engine" }
indicatif = { version = "0.17.8", optional = true }
thiserror = "1.0.61"
tracing = { version = "0.1.40", optional = true }
Expand Down

0 comments on commit 4a02419

Please sign in to comment.