Skip to content

Commit 09340c0

Browse files
committed
Improve rust code
1 parent 7a1335f commit 09340c0

7 files changed

Lines changed: 291 additions & 285 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ jobs:
1414
run:
1515
working-directory: docs
1616
steps:
17-
- uses: actions/checkout@v4
17+
- uses: actions/checkout@v5
1818
- name: Install pnpm
1919
uses: pnpm/action-setup@v4
2020
with:
2121
package_json_file: docs/package.json
2222
- name: Use Node.js
2323
uses: actions/setup-node@v4
2424
with:
25-
node-version: 24.3.0
25+
node-version: 24
2626
cache: "pnpm"
2727
cache-dependency-path: docs/pnpm-lock.yaml
2828
- name: Install dependencies

.github/workflows/rust.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
run:
1818
working-directory: ${{ matrix.project }}
1919
steps:
20-
- uses: actions/checkout@v4
20+
- uses: actions/checkout@v5
2121
- uses: pnpm/action-setup@v4
2222
if: matrix.project == 'cli'
2323
with:
@@ -49,9 +49,9 @@ jobs:
4949
run:
5050
working-directory: example
5151
steps:
52-
- uses: actions/checkout@v4
52+
- uses: actions/checkout@v5
5353
- name: Download CLI artifacts
54-
uses: actions/download-artifact@v4
54+
uses: actions/download-artifact@v5
5555
with:
5656
name: cli-artifacts
5757
path: example/cli

Cargo.lock

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli/src/directory.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ impl RepositoryDirectory {
8888
continue;
8989
}
9090
let path = entry.path();
91-
let file_name = path.file_name().unwrap().to_str().unwrap().to_string();
91+
let file_name = entry
92+
.file_name()
93+
.into_string()
94+
.unwrap_or_else(|os_str| os_str.to_string_lossy().into_owned());
9295

9396
if path.is_dir() {
9497
authors.push(file_name);
@@ -127,7 +130,10 @@ impl AuthorDirectory<'_> {
127130
continue;
128131
};
129132
let path = entry.path();
130-
let file_name = path.file_name().unwrap().to_str().unwrap().to_string();
133+
let Some(file_name) = path.file_name() else {
134+
continue;
135+
};
136+
let file_name = file_name.to_string_lossy().to_string();
131137

132138
if path.is_dir() {
133139
assets.push(file_name);

cli/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ fn main() {
7474
fn docs(path: String, index: String, page_size: usize) {
7575
let data = RepositoryData::from_index(
7676
std::fs::read_to_string(&index)
77-
.unwrap_or_else(|_| panic!("Could not read index file {}", &index))
78-
.as_ref(),
77+
.unwrap_or_else(|_| panic!("Could not read index file {index}"))
78+
.as_str(),
7979
)
8080
.expect("Could not parse index file");
8181
let result = docs::generate_docs(&data, path, page_size);

docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
"@astrojs/react": "^4.3.0",
1515
"@astrojs/starlight": "^0.35.2",
1616
"@phosphor-icons/react": "^2.1.10",
17-
"@types/react": "^19.1.9",
17+
"@types/react": "^19.1.10",
1818
"@types/react-dom": "^19.1.7",
19-
"astro": "^5.12.8",
19+
"astro": "^5.12.9",
2020
"react": "^19.1.1",
2121
"react-dom": "^19.1.1",
2222
"remark-gemoji": "^8.0.0",

0 commit comments

Comments
 (0)