Skip to content

Commit ed6b6c1

Browse files
committed
Merge branch 'main' into default-impl
# Conflicts: # src/code.rs
2 parents ba8b38d + d56b152 commit ed6b6c1

File tree

4 files changed

+31
-49
lines changed

4 files changed

+31
-49
lines changed

.github/workflows/CI.yml

Lines changed: 19 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: CI
22
on:
33
push:
4-
branches:
5-
- main
64
pull_request:
75
workflow_dispatch:
86

@@ -15,20 +13,23 @@ concurrency:
1513

1614
jobs:
1715
build:
18-
name: cargo build
19-
runs-on: ubuntu-latest
16+
name: cargo build & test
17+
strategy:
18+
matrix:
19+
os: [ubuntu-latest]
20+
rust: [stable, "1.70"]
21+
runs-on: ${{ matrix.os }}
2022
steps:
2123
- uses: actions/checkout@v4
2224
- uses: rui314/setup-mold@v1
2325
- uses: dtolnay/rust-toolchain@stable
24-
- uses: actions/cache@v3
2526
with:
26-
path: |
27-
./.cargo/.build
28-
./target
29-
~/.cargo
30-
key: ${{ runner.os }}-cargo-dev-${{ hashFiles('**/Cargo.lock') }}
27+
toolchain: ${{ matrix.rust }}
28+
- uses: Swatinem/rust-cache@v2
29+
with:
30+
shared-key: "build"
3131
- run: cargo build --all-targets
32+
- run: cargo test
3233

3334
clippy:
3435
name: cargo clippy
@@ -38,14 +39,11 @@ jobs:
3839
- uses: actions/checkout@v4
3940
- uses: rui314/setup-mold@v1
4041
- uses: dtolnay/rust-toolchain@stable
41-
- run: rustup component add clippy
42-
- uses: actions/cache@v3
4342
with:
44-
path: |
45-
./.cargo/.build
46-
./target
47-
~/.cargo
48-
key: ${{ runner.os }}-cargo-dev-${{ hashFiles('**/Cargo.lock') }}
43+
components: clippy
44+
- uses: Swatinem/rust-cache@v2
45+
with:
46+
shared-key: "build"
4947
- run: cargo clippy --all
5048

5149
test-script:
@@ -56,33 +54,12 @@ jobs:
5654
- uses: actions/checkout@v4
5755
- uses: rui314/setup-mold@v1
5856
- uses: dtolnay/rust-toolchain@stable
59-
- uses: actions/cache@v3
57+
- uses: Swatinem/rust-cache@v2
6058
with:
61-
path: |
62-
./.cargo/.build
63-
./target
64-
~/.cargo
65-
key: ${{ runner.os }}-cargo-dev-${{ hashFiles('**/Cargo.lock') }}
59+
shared-key: "build"
6660
- run: bash test/test_all.sh
6761
- run: git diff --exit-code --stat || exit 1
6862

69-
# things that use the cargo-test cache
70-
test:
71-
name: cargo test
72-
runs-on: ubuntu-latest
73-
steps:
74-
- uses: actions/checkout@v4
75-
- uses: rui314/setup-mold@v1
76-
- uses: dtolnay/rust-toolchain@stable
77-
- uses: actions/cache@v3
78-
with:
79-
path: |
80-
./.cargo/.build
81-
./target
82-
~/.cargo
83-
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
84-
- run: cargo test
85-
8663
# Things that don't need a cache
8764
fmt:
8865
name: cargo fmt
@@ -92,13 +69,13 @@ jobs:
9269
- uses: dtolnay/rust-toolchain@stable
9370
with:
9471
toolchain: nightly
95-
- run: rustup component add rustfmt
72+
components: rustfmt
9673
- run: cargo fmt --all -- --check
9774

9875
release:
9976
runs-on: ubuntu-latest
10077
name: release
101-
needs: [build, clippy, test, test-script, fmt]
78+
needs: [build, clippy, test-script, fmt]
10279
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main'
10380
permissions:
10481
contents: write # for actions/checkout to fetch code and for semantic-release to push commits, release releases and tags

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## next
4+
5+
- set MSRV to `1.70`
6+
37
## 0.1.0
48

59
- replace `structopt` with `clap`

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ authors = [
1717
"hasezoey <[email protected]>",
1818
]
1919
edition = "2021"
20+
rust-version = "1.70"
2021

2122
[features]
2223
default = ["tsync", "backtrace", "derive-queryablebyname"]

src/error.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,21 @@ impl Error {
6161
M: Into<String>,
6262
P: AsRef<Path>,
6363
{
64-
return Self::new(ErrorEnum::IoError(
64+
Self::new(ErrorEnum::IoError(
6565
ioError::new(kind, msg.into()),
6666
format_path(path.as_ref().to_string_lossy().to_string()),
67-
));
67+
))
6868
}
6969

7070
pub fn not_a_directory<M, P>(msg: M, path: P) -> Self
7171
where
7272
M: Into<String>,
7373
P: AsRef<Path>,
7474
{
75-
return Self::new(ErrorEnum::NotADirectory(
75+
Self::new(ErrorEnum::NotADirectory(
7676
msg.into(),
7777
path.as_ref().to_string_lossy().to_string(),
78-
));
78+
))
7979
}
8080
}
8181

@@ -87,7 +87,7 @@ impl std::fmt::Display for Error {
8787

8888
impl std::error::Error for Error {
8989
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
90-
return self.source.source();
90+
self.source.source()
9191
}
9292
}
9393

@@ -148,13 +148,13 @@ pub trait IOErrorToError<T> {
148148

149149
impl<T> IOErrorToError<T> for std::result::Result<T, std::io::Error> {
150150
fn attach_path_err<P: AsRef<Path>>(self, path: P) -> Result<T> {
151-
return match self {
151+
match self {
152152
Ok(v) => Ok(v),
153153
Err(e) => Err(crate::Error::new(ErrorEnum::IoError(
154154
e,
155155
format_path(path.as_ref().to_string_lossy().to_string()),
156156
))),
157-
};
157+
}
158158
}
159159

160160
fn attach_path_msg<P: AsRef<Path>, M: AsRef<str>>(self, path: P, msg: M) -> Result<T> {

0 commit comments

Comments
 (0)