Repository navigation
Expand file tree
/
Copy pathclippy.toml
More file actions
44 lines (43 loc) · 2.51 KB
/
Copy pathclippy.toml
File metadata and controls
44 lines (43 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Size above which `clippy::large_futures` fires (bytes).
#
# NOT set by any current fix: boxed, the call site that prompted this lint is
# ~630 B and would pass clippy's 16 KiB default easily. The threshold is raised
# only because ~34 pre-existing futures in this crate (`get_objects`,
# `stream_transfer`, the protobuf handlers) sit at 17-30 KB, and boxing them is a
# separate cleanup. 40000 is just above that ceiling.
#
# What it still catches is the failure mode that motivated it: composing an
# already-large future *by value* into a combinator, which multiplies rather than
# adds. That measured ~120 KB and overflowed the tokio worker stack under
# `cargo llvm-cov` — an abort on Linux, SIGBUS on macOS. Fix shape: `Box::pin` the
# inner future before handing it to the combinator.
#
# Ratchet this down as the pre-existing sites get boxed.
future-size-threshold = 40000
# Bindings `clippy::disallowed_names` rejects. `..` keeps clippy's defaults
# (`foo`, `baz`, `quux`); `ctx` is this repo's addition.
#
# `ctx` is banned because several unrelated context types are routinely in scope
# together — `OperationCtx`, `RefreshContext`, `HttpContext`,
# `StageInfoRefreshContext`, `TransferCtx` — so the name says nothing about which
# one a binding holds. The failure it prevents is silent: adding an
# `operation_ctx: Option<&OperationCtx>` parameter to a function that already
# binds a `RefreshContext` as `ctx` shadows one with the other, and for an
# `async_first` RPC that means cancellation stops being observed while the code
# still compiles. `perform_put_get_transfer` had a closure binding a
# `StageInfoRefreshContext` as `ctx` inside a function whose own parameter was an
# `OperationCtx`.
#
# The lint covers function parameters, `let` bindings, and closure parameters,
# and `.pre-commit-config.yaml` runs clippy with `-Dclippy::all`, so this is a
# hard error rather than a warning. Name bindings after the type they hold:
# `operation_ctx`, `refresh_ctx`, `http_ctx`, `stage_refresh_ctx`.
#
# Rust only, and deliberately not a repo-wide convention. This file is read by
# `cargo clippy` alone, and the reasoning does not carry to the wrappers: Go has
# a single context type, so `ctx` is unambiguous there and is what the standard
# library and the `database/sql` driver interfaces
# (`QueryContext(ctx context.Context, …)`) expect as the first parameter. Go code
# under `gosnowflake/` should use `ctx`; only Rust, where several unrelated
# context types coexist, has the collision this guards against.
disallowed-names = ["..", "ctx"]