Skip to content

Commit

Permalink
bridge: Import most clippy settings from server
Browse files Browse the repository at this point in the history
  • Loading branch information
svix-jplatte committed Aug 5, 2024
1 parent b4a800a commit e959f5f
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 9 deletions.
2 changes: 2 additions & 0 deletions bridge/.clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
allow-mixed-uninlined-format-args = false
avoid-breaking-exported-api = false
13 changes: 13 additions & 0 deletions bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ members = [
"svix-bridge-plugin-kafka",
]

[workspace.lints.rust]
rust_2018_idioms = { level = "warn", priority = -1 }
trivial_numeric_casts = "warn"

[workspace.lints.clippy]
cloned_instead_of_copied = "warn"
dbg_macro = "warn"
inefficient_to_string = "warn"
macro_use_imports = "warn"
mut_mut = "warn"
nonstandard_macro_braces = "warn"
uninlined_format_args = "warn"

[workspace.dependencies]
serde = { version = "1.0.203", features = ["derive"] }
serde_json = "1.0.117"
Expand Down
3 changes: 3 additions & 0 deletions bridge/svix-bridge-plugin-kafka/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ tracing.workspace = true
ctor = "0.2.8"
tracing-subscriber.workspace = true
wiremock.workspace = true

[lints]
workspace = true
3 changes: 3 additions & 0 deletions bridge/svix-bridge-plugin-queue/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ lapin = "2"
redis = { version = "0.25.4", features = ["tokio-comp", "streams"] }
tracing-subscriber.workspace = true
wiremock.workspace = true

[lints]
workspace = true
3 changes: 3 additions & 0 deletions bridge/svix-bridge-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ tokio.workspace = true
serde.workspace = true
serde_json.workspace = true
svix = { version = "1.25.0", features = ["svix_beta"] }

[lints]
workspace = true
3 changes: 3 additions & 0 deletions bridge/svix-bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ tower = "0.4"
default = ["kafka", "jemalloc"]
kafka = ["dep:svix-bridge-plugin-kafka"]
jemalloc = ["tikv-jemallocator", "tikv-jemalloc-ctl"]

[lints]
workspace = true
10 changes: 3 additions & 7 deletions bridge/svix-bridge/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,16 @@ impl Config {
Cow::Borrowed(raw_src)
};
let cfg: Self = serde_yaml::from_str(&src)
.map_err(|e| Error::new(ErrorKind::Other, format!("Failed to parse config: {}", e)))?;
.map_err(|e| Error::new(ErrorKind::Other, format!("Failed to parse config: {e}")))?;

for sc in &cfg.senders {
if let Some(tc) = sc.transformation() {
crate::runtime::validate_script(tc.source().as_str()).map_err(|e| {
Error::new(
ErrorKind::Other,
format!(
"failed to parse transformation for sender `{}`: {:?}",
"failed to parse transformation for sender `{}`: {e:?}",
&sc.name(),
e,
),
)
})?;
Expand All @@ -102,10 +101,7 @@ impl Config {
crate::runtime::validate_script(tc.source().as_str()).map_err(|e| {
Error::new(
ErrorKind::Other,
format!(
"failed to parse transformation for receiver `{}`: {:?}",
name, e,
),
format!("failed to parse transformation for receiver `{name}`: {e:?}"),
)
})?;
}
Expand Down
3 changes: 1 addition & 2 deletions bridge/svix-bridge/src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,9 @@ fn run_script_inner(
r#"
(function () {{
{script}
return handler({});
return handler({input});
}})()
"#,
input
)
.into(),
);
Expand Down

0 comments on commit e959f5f

Please sign in to comment.