Skip to content

Commit c697d06

Browse files
authored
Merge pull request ogham#1125 from Tyrubias/upgrade-and-cleanup
Upgrade both Rust version and edition (and fix some lints)
2 parents f3ca1fe + ee67110 commit c697d06

37 files changed

+115
-118
lines changed

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
strategy:
2929
matrix:
3030
os: [ubuntu-latest, macos-latest]
31-
rust: [1.56.1, stable, beta, nightly]
31+
rust: [1.63.0, stable, beta, nightly]
3232

3333
steps:
3434
- name: Checkout repository

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name = "exa"
33
description = "A modern replacement for ls"
44
authors = ["Benjamin Sago <[email protected]>"]
55
categories = ["command-line-utilities"]
6-
edition = "2018"
7-
rust-version = "1.56.1"
6+
edition = "2021"
7+
rust-version = "1.63.0"
88
exclude = ["/devtools/*", "/Justfile", "/Vagrantfile", "/screenshots.png"]
99
readme = "README.md"
1010
homepage = "https://the.exa.website/"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ To build without Git support, run `cargo install --no-default-features exa` is a
196196
<a id="development">
197197
<h1>Development
198198

199-
<a href="https://blog.rust-lang.org/2021/11/01/Rust-1.56.1.html">
200-
<img src="https://img.shields.io/badge/rustc-1.56.1+-lightgray.svg" alt="Rust 1.56.1+" />
199+
<a href="https://blog.rust-lang.org/2022/08/11/Rust-1.63.0.html">
200+
<img src="https://img.shields.io/badge/rustc-1.63.0+-lightgray.svg" alt="Rust 1.63.0+" />
201201
</a>
202202

203203
<a href="https://github.com/ogham/exa/blob/master/LICENCE">

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fn main() -> io::Result<()> {
4141
let path = &out.join("version_string.txt");
4242

4343
// Bland version text
44-
let mut f = File::create(path).expect(&path.to_string_lossy());
44+
let mut f = File::create(path).unwrap_or_else(|_| { panic!("{}", path.to_string_lossy().to_string()) });
4545
writeln!(f, "{}", strip_codes(&ver))?;
4646

4747
Ok(())

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[toolchain]
2-
channel = "1.56.1"
2+
channel = "1.63.0"

src/fs/dir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ impl<'dir, 'ig> Iterator for Files<'dir, 'ig> {
176176
/// Usually files in Unix use a leading dot to be hidden or visible, but two
177177
/// entries in particular are “extra-hidden”: `.` and `..`, which only become
178178
/// visible after an extra `-a` option.
179-
#[derive(PartialEq, Debug, Copy, Clone)]
179+
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
180180
pub enum DotFilter {
181181

182182
/// Shows files, dotfiles, and `.` and `..`.

src/fs/dir_action.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/// into them and print out their contents. The recurse mode does this by
2020
/// having extra output blocks at the end, while the tree mode will show
2121
/// directories inline, with their contents immediately underneath.
22-
#[derive(PartialEq, Debug, Copy, Clone)]
22+
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
2323
pub enum DirAction {
2424

2525
/// This directory should be listed along with the regular files, instead
@@ -58,7 +58,7 @@ impl DirAction {
5858

5959

6060
/// The options that determine how to recurse into a directory.
61-
#[derive(PartialEq, Debug, Copy, Clone)]
61+
#[derive(PartialEq, Eq, Debug, Copy, Clone)]
6262
pub struct RecurseOptions {
6363

6464
/// Whether recursion should be done as a tree or as multiple individual

src/fs/feature/xattr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ mod lister {
167167
unsafe {
168168
listxattr(
169169
c_path.as_ptr(),
170-
buf.as_mut_ptr() as *mut c_char,
170+
buf.as_mut_ptr().cast::<c_char>(),
171171
bufsize as size_t,
172172
self.c_flags,
173173
)
@@ -178,7 +178,7 @@ mod lister {
178178
unsafe {
179179
getxattr(
180180
c_path.as_ptr(),
181-
buf.as_ptr() as *const c_char,
181+
buf.as_ptr().cast::<c_char>(),
182182
ptr::null_mut(),
183183
0,
184184
0,

src/fs/fields.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ pub struct Time {
210210
/// A file’s status in a Git repository. Whether a file is in a repository or
211211
/// not is handled by the Git module, rather than having a “null” variant in
212212
/// this enum.
213-
#[derive(PartialEq, Copy, Clone)]
213+
#[derive(PartialEq, Eq, Copy, Clone)]
214214
pub enum GitStatus {
215215

216216
/// This file hasn’t changed since the last commit.

src/fs/file.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,13 @@ impl<'dir> File<'dir> {
221221
path.to_path_buf()
222222
}
223223
else if let Some(dir) = self.parent_dir {
224-
dir.join(&*path)
224+
dir.join(path)
225225
}
226226
else if let Some(parent) = self.path.parent() {
227-
parent.join(&*path)
227+
parent.join(path)
228228
}
229229
else {
230-
self.path.join(&*path)
230+
self.path.join(path)
231231
}
232232
}
233233

@@ -375,7 +375,7 @@ impl<'dir> File<'dir> {
375375
nanosec -= 1_000_000_000;
376376
}
377377

378-
let duration = Duration::new(sec.abs() as u64, nanosec.abs() as u32);
378+
let duration = Duration::new(sec.unsigned_abs(), nanosec.unsigned_abs() as u32);
379379
Some(UNIX_EPOCH - duration)
380380
}
381381
else {

0 commit comments

Comments
 (0)