Skip to content

Commit 4a28658

Browse files
committed
Fix Rust 1.95 CI warnings
Update Rust code for new Clippy lints introduced by the CI toolchain, including Duration unit constructors, loop counter handling, Option checks, and trailing commas. Stop routine frontend asset downloads from being emitted as Cargo warnings during builds. Move checkout and rust-cache GitHub Actions to Node 24-compatible releases to avoid runner deprecation warnings. User-level behavior is unchanged; the only observable change is quieter build logs.
1 parent f6e7abc commit 4a28658

10 files changed

Lines changed: 27 additions & 35 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ jobs:
2424
compile_and_lint:
2525
runs-on: ubuntu-latest
2626
steps:
27-
- uses: actions/checkout@v4
27+
- uses: actions/checkout@v6.0.2
2828
- run: npm ci
2929
- run: npm test
3030
- name: Set up cargo cache
31-
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
31+
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4
3232
with:
3333
shared-key: rust-sqlpage-proj-test
3434
save-if: ${{ github.ref == 'refs/heads/main' }}
@@ -63,9 +63,9 @@ jobs:
6363
container: oracle
6464
db_url: "Driver=Oracle 21 ODBC driver;Dbq=//127.0.0.1:1521/FREEPDB1;Uid=root;Pwd=Password123!"
6565
steps:
66-
- uses: actions/checkout@v4
66+
- uses: actions/checkout@v6.0.2
6767
- name: Set up cargo cache
68-
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
68+
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4
6969
with:
7070
shared-key: rust-sqlpage-proj-test
7171
save-if: false
@@ -98,9 +98,9 @@ jobs:
9898
windows_test:
9999
runs-on: windows-latest
100100
steps:
101-
- uses: actions/checkout@v4
101+
- uses: actions/checkout@v6.0.2
102102
- name: Set up cargo cache
103-
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
103+
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4
104104
- name: Check port usage
105105
run: netstat -bano
106106
- run: cargo test
@@ -130,7 +130,7 @@ jobs:
130130
variant: duckdb
131131
steps:
132132
- name: Checkout
133-
uses: actions/checkout@v4
133+
uses: actions/checkout@v6.0.2
134134
- id: suffix
135135
name: Cache name suffix
136136
run: |

.github/workflows/official-site.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Cloning repo
15-
uses: actions/checkout@v4
15+
uses: actions/checkout@v6.0.2
1616
with:
1717
fetch-depth: 0
1818
- id: get_gitsha

.github/workflows/playwright.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
working-directory: ./tests/end-to-end
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v6.0.2
1616
- name: Set up cargo cache
17-
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
17+
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4
1818
- uses: actions/setup-node@v4
1919
with:
2020
node-version: lts/*
@@ -41,4 +41,4 @@ jobs:
4141
with:
4242
name: playwright-report
4343
path: ./tests/end-to-end/playwright-report/
44-
retention-days: 30
44+
retention-days: 30

.github/workflows/release.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ jobs:
2929
target: x86_64-apple-darwin
3030
features: "odbc-static"
3131
steps:
32-
- uses: actions/checkout@v4
32+
- uses: actions/checkout@v6.0.2
3333
- name: Install Rust toolchain
3434
uses: dtolnay/rust-toolchain@stable
3535
with:
3636
targets: ${{ matrix.target }}
3737
- name: Set up cargo cache
38-
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
38+
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4
3939
- name: Build
4040
run: cargo build --profile superoptimized --locked --target ${{ matrix.target }} --features "${{ matrix.features }}"
4141
- name: Upload unsigned Windows artifact
@@ -84,13 +84,13 @@ jobs:
8484
runs-on: ubuntu-latest
8585
container: quay.io/pypa/manylinux_2_28_x86_64
8686
steps:
87-
- uses: actions/checkout@v4
87+
- uses: actions/checkout@v6.0.2
8888
- name: Install Rust toolchain
8989
uses: dtolnay/rust-toolchain@stable
9090
with:
9191
targets: x86_64-unknown-linux-gnu
9292
- name: Set up cargo cache
93-
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
93+
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4
9494
- name: Build
9595
run: cargo build --profile superoptimized --locked --target x86_64-unknown-linux-gnu --features "odbc-static"
9696
- uses: actions/upload-artifact@v4
@@ -103,7 +103,7 @@ jobs:
103103
name: Build AWS Lambda Serverless zip image
104104
runs-on: ubuntu-latest
105105
steps:
106-
- uses: actions/checkout@v4
106+
- uses: actions/checkout@v6.0.2
107107
- run: docker build -t sqlpage-lambda-builder . -f lambda.Dockerfile --target builder
108108
- run: docker run sqlpage-lambda-builder cat deploy.zip > sqlpage-aws-lambda.zip
109109
- uses: actions/upload-artifact@v4
@@ -117,7 +117,7 @@ jobs:
117117
runs-on: ubuntu-latest
118118
if: startsWith(github.ref, 'refs/tags/')
119119
steps:
120-
- uses: actions/checkout@v4
120+
- uses: actions/checkout@v6.0.2
121121
- uses: actions/download-artifact@v4
122122
- run: |
123123
rm -rf sqlpage/templates/*.handlebars;
@@ -147,9 +147,9 @@ jobs:
147147
runs-on: ubuntu-latest
148148
if: startsWith(github.ref, 'refs/tags/')
149149
steps:
150-
- uses: actions/checkout@v4
150+
- uses: actions/checkout@v6.0.2
151151
- name: Set up cargo cache
152-
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
152+
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4
153153
- run: sudo apt-get update && sudo apt-get install -y unixodbc-dev
154154
- name: Publish to crates.io
155155
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}

build.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ async fn process_input_file(client: &awc::Client, path_out: &Path, original: Fil
7171
if std::env::var("DOCS_RS").is_err() {
7272
copy_url_to_opened_file(client, url, &mut outfile).await;
7373
} else {
74-
println!("cargo:warning=Skipping download of {url} because we're building docs.");
7574
return;
7675
}
7776
outfile.write_all(b"\n").unwrap();
@@ -93,7 +92,6 @@ async fn copy_url_to_opened_file(
9392
// If the file has been downloaded manually, use it
9493
let cached_file_path = make_url_path(url);
9594
if !cached_file_path.exists() {
96-
println!("cargo:warning=Downloading {url} to cache file {cached_file_path:?}.");
9795
download_url_to_path(client, url, &cached_file_path).await;
9896
println!("cargo:rerun-if-changed={}", cached_file_path.display());
9997
}
@@ -133,7 +131,7 @@ async fn download_url_to_path(client: &awc::Client, url: &str, path: &Path) {
133131
);
134132
}
135133
sleep(Duration::from_secs(1)).await;
136-
println!("cargo:warning=Retrying download of {url} after {err}.");
134+
eprintln!("Retrying download of {url} after {err}.");
137135
attempt += 1;
138136
}
139137
}

src/app_config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ impl AppConfig {
9494
if is_sqlite {
9595
None
9696
} else {
97-
Some(Duration::from_secs(30 * 60))
97+
Some(Duration::from_mins(30))
9898
},
9999
);
100100
self.database_connection_max_lifetime = resolve_timeout(
101101
self.database_connection_max_lifetime,
102102
if is_sqlite {
103103
None
104104
} else {
105-
Some(Duration::from_secs(60 * 60))
105+
Some(Duration::from_hours(1))
106106
},
107107
);
108108
}

src/webserver/database/error_highlighting.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,19 +148,17 @@ pub fn highlight_line_offset<W: std::fmt::Write>(msg: &mut W, line: &str, offset
148148
/// line and `col_num` are 1-based
149149
pub fn quote_source_with_highlight(source: &str, line_num: u64, col_num: u64) -> String {
150150
let mut msg = String::new();
151-
let mut current_line_num: u64 = 1; // 1-based line number
152151
let col_num_usize = usize::try_from(col_num)
153152
.unwrap_or_default()
154153
.saturating_sub(1);
155-
for line in source.lines() {
154+
for (current_line_num, line) in (1_u64..).zip(source.lines()) {
156155
if current_line_num + 1 == line_num || current_line_num == line_num + 1 {
157156
writeln!(msg, "{line}").unwrap();
158157
} else if current_line_num == line_num {
159158
highlight_line_offset(&mut msg, line, col_num_usize);
160159
} else if current_line_num > line_num + 1 {
161160
break;
162161
}
163-
current_line_num += 1;
164162
}
165163
msg
166164
}

src/webserver/database/sql.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@ mod test {
11161116
assert_eq!(query, "SELECT CURRENT_TIMESTAMP AS sqlpage_set_expr");
11171117
assert!(params.is_empty());
11181118
} else {
1119-
panic!("Failed for dialect {dialect:?}: {stmt:#?}",);
1119+
panic!("Failed for dialect {dialect:?}: {stmt:#?}");
11201120
}
11211121
}
11221122
}

src/webserver/http_request_info.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,7 @@ async fn is_file_field_empty(
298298
) -> anyhow::Result<bool> {
299299
Ok(
300300
uploaded_file.content_type == Some(mime_guess::mime::APPLICATION_OCTET_STREAM)
301-
&& uploaded_file
302-
.file_name
303-
.as_ref()
304-
.filter(|x| !x.is_empty())
305-
.is_none()
301+
&& uploaded_file.file_name.as_deref().is_none_or(str::is_empty)
306302
&& tokio::fs::metadata(&uploaded_file.file.path()).await?.len() == 0,
307303
)
308304
}

src/webserver/oidc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const SQLPAGE_REDIRECT_URI: &str = "/sqlpage/oidc_callback";
4848
const SQLPAGE_LOGOUT_URI: &str = "/sqlpage/oidc_logout";
4949
const SQLPAGE_NONCE_COOKIE_NAME: &str = "sqlpage_oidc_nonce";
5050
const SQLPAGE_TMP_LOGIN_STATE_COOKIE_PREFIX: &str = "sqlpage_oidc_state_";
51-
const OIDC_CLIENT_MAX_REFRESH_INTERVAL: Duration = Duration::from_secs(60 * 60);
51+
const OIDC_CLIENT_MAX_REFRESH_INTERVAL: Duration = Duration::from_hours(1);
5252
const OIDC_CLIENT_MIN_REFRESH_INTERVAL: Duration = Duration::from_secs(5);
5353
const OIDC_HTTP_BODY_TIMEOUT: Duration = OIDC_CLIENT_MIN_REFRESH_INTERVAL;
5454
const SQLPAGE_OIDC_REDIRECT_COUNT_COOKIE: &str = "sqlpage_oidc_redirect_count";
@@ -998,7 +998,7 @@ fn make_oidc_client(
998998
if needs_http {
999999
log::debug!("App host seems to be local, changing redirect URL to HTTP");
10001000
redirect_url =
1001-
RedirectUrl::new(format!("http://{}{}", config.app_host, config.redirect_uri,))?;
1001+
RedirectUrl::new(format!("http://{}{}", config.app_host, config.redirect_uri))?;
10021002
}
10031003
log::info!("OIDC redirect URL for {}: {redirect_url}", config.client_id);
10041004
let client =

0 commit comments

Comments
 (0)