Skip to content

Commit 0759b92

Browse files
committed
factors: Fix clippy lints
Signed-off-by: Lann Martin <[email protected]>
1 parent 49ec0f0 commit 0759b92

File tree

8 files changed

+13
-11
lines changed

8 files changed

+13
-11
lines changed

crates/factor-key-value-azure/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ use spin_key_value_azure::{
55
};
66

77
/// A key-value store that uses Azure Cosmos as the backend.
8+
#[derive(Default)]
89
pub struct AzureKeyValueStore {
910
_priv: (),
1011
}
1112

1213
impl AzureKeyValueStore {
1314
/// Creates a new `AzureKeyValueStore`.
1415
pub fn new() -> Self {
15-
Self { _priv: () }
16+
Self::default()
1617
}
1718
}
1819

crates/factor-key-value-redis/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ use spin_factor_key_value::runtime_config::spin::MakeKeyValueStore;
33
use spin_key_value_redis::KeyValueRedis;
44

55
/// A key-value store that uses Redis as the backend.
6+
#[derive(Default)]
67
pub struct RedisKeyValueStore {
78
_priv: (),
89
}
910

1011
impl RedisKeyValueStore {
1112
/// Creates a new `RedisKeyValueStore`.
1213
pub fn new() -> Self {
13-
Self { _priv: () }
14+
Self::default()
1415
}
1516
}
1617

crates/factor-outbound-redis/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ use spin_factors::{
88
};
99

1010
/// The [`Factor`] for `fermyon:spin/outbound-redis`.
11+
#[derive(Default)]
1112
pub struct OutboundRedisFactor {
1213
_priv: (),
1314
}
1415

1516
impl OutboundRedisFactor {
1617
pub fn new() -> Self {
17-
Self { _priv: () }
18+
Self::default()
1819
}
1920
}
2021

crates/factor-sqlite/src/host.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ impl InstanceState {
4444
fn get_connection(
4545
&self,
4646
connection: Resource<v2::Connection>,
47-
) -> Result<&Box<dyn Connection>, v2::Error> {
47+
) -> Result<&dyn Connection, v2::Error> {
4848
self.connections
4949
.get(connection.rep())
50+
.map(|conn| conn.as_ref())
5051
.ok_or(v2::Error::InvalidConnection)
5152
}
5253
}

crates/factor-sqlite/tests/factor_test.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ impl FactorRuntimeConfigSource<SqliteFactor> for TomlRuntimeSource<'_> {
104104

105105
impl RuntimeConfigSourceFinalizer for TomlRuntimeSource<'_> {
106106
fn finalize(&mut self) -> anyhow::Result<()> {
107-
Ok(self.table.validate_all_keys_used().unwrap())
107+
self.table.validate_all_keys_used()?;
108+
Ok(())
108109
}
109110
}
110111

crates/factor-variables/src/spin_cli/azure_key_vault.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ pub enum AzureKeyVaultAuthOptions {
9090
///
9191
/// Common across each:
9292
/// - `AZURE_AUTHORITY_HOST`: (optional) the host for the identity provider. For example, for Azure public cloud the host defaults to "https://login.microsoftonline.com".
93+
///
9394
/// See also: https://github.com/Azure/azure-sdk-for-rust/blob/main/sdk/identity/README.md
9495
Environmental,
9596
}

crates/factor-variables/tests/factor_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async fn static_provider_works() -> anyhow::Result<()> {
3131
}))?;
3232

3333
let mut state = env.build_instance_state().await?;
34-
let val = state.variables.get("baz".try_into().unwrap()).await?;
34+
let val = state.variables.get("baz".into()).await?;
3535
assert_eq!(val, "<bar>");
3636
Ok(())
3737
}

crates/runtime-config/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,7 @@ impl FactorRuntimeConfigSource<OutboundMysqlFactor> for TomlRuntimeConfigSource<
187187

188188
impl FactorRuntimeConfigSource<LlmFactor> for TomlRuntimeConfigSource<'_> {
189189
fn get_runtime_config(&mut self) -> anyhow::Result<Option<spin_factor_llm::RuntimeConfig>> {
190-
Ok(llm::runtime_config_from_toml(
191-
self.table.as_ref(),
192-
self.state_dir.clone(),
193-
self.use_gpu,
194-
)?)
190+
llm::runtime_config_from_toml(self.table.as_ref(), self.state_dir.clone(), self.use_gpu)
195191
}
196192
}
197193

0 commit comments

Comments
 (0)