Skip to content

Commit de791b2

Browse files
authored
CI: run Clippy on web-default features for Web-compatible crates (#2434)
1 parent ecfce50 commit de791b2

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

.github/workflows/rust.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,13 @@ jobs:
209209
cargo clippy --all-targets --all-features --target x86_64-unknown-linux-gnu --locked
210210
- name: Run clippy
211211
run: |
212-
cargo clippy --all-targets --all-features --locked
213-
cargo clippy --no-default-features --features kubernetes --locked
214-
cargo clippy --no-default-features --locked
212+
cargo clippy --locked --all-targets --all-features
213+
cargo clippy --locked --no-default-features --features kubernetes
214+
cargo clippy --locked --no-default-features
215+
cargo clippy --locked --target wasm32-unknown-unknown --no-default-features --features web-default \
216+
-p linera-client \
217+
-p linera-rpc \
218+
-p linera-views
215219
- name: Run cargo doc
216220
run: |
217221
cargo doc --locked --all-features

linera-rpc/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ web = [
3939
"linera-execution/web",
4040
]
4141

42+
web-default = ["web"]
43+
4244
[dependencies]
4345
anyhow.workspace = true
4446
async-trait.workspace = true

linera-views/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ metrics = ["dep:hex", "linera-base/metrics", "linera-views-derive/metrics"]
2323
test = ["tokio/macros", "rand"]
2424
web = ["linera-base/web"]
2525
indexeddb = ["indexed_db_futures", "wasm-bindgen"]
26+
web-default = ["web", "indexeddb"]
2627

2728
dynamodb = ["aws-config", "aws-sdk-dynamodb", "aws-smithy-types"]
2829
scylladb = ["scylla"]

linera-views/src/indexed_db.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Zefchain Labs, Inc.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
use std::{fmt::Debug, sync::Arc};
4+
use std::{fmt::Debug, rc::Rc};
55

66
use futures::future;
77
use indexed_db_futures::{js_sys, prelude::*, web_sys};
@@ -44,7 +44,7 @@ const DATABASE_NAME: &str = "linera";
4444
/// API](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API#:~:text=IndexedDB%20is%20a%20low%2Dlevel,larger%20amounts%20of%20structured%20data.).
4545
pub struct IndexedDbStore {
4646
/// The database used for storing the data.
47-
pub database: Arc<IdbDatabase>,
47+
pub database: Rc<IdbDatabase>,
4848
/// The object store name used for storing the data.
4949
pub object_store_name: String,
5050
/// The maximum number of queries used for the stream.
@@ -249,7 +249,7 @@ impl LocalAdminKeyValueStore for IndexedDbStore {
249249
}));
250250
database = db_req.await?;
251251
}
252-
let database = Arc::new(database);
252+
let database = Rc::new(database);
253253
let root_key = root_key.to_vec();
254254
Ok(IndexedDbStore {
255255
database,
@@ -374,11 +374,11 @@ pub enum IndexedDbStoreError {
374374
DatabaseConsistencyError(#[from] DatabaseConsistencyError),
375375

376376
/// A DOM exception occurred in the IndexedDB operations
377-
#[error("DOM exception: {}", self.to_string())]
377+
#[error("DOM exception: {0:?}")]
378378
Dom(web_sys::DomException),
379379

380380
/// JavaScript threw an exception whilst handling IndexedDB operations
381-
#[error("JavaScript exception: {}", self.to_string())]
381+
#[error("JavaScript exception: {0:?}")]
382382
Js(wasm_bindgen::JsValue),
383383
}
384384

0 commit comments

Comments
 (0)