-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCargo.toml
More file actions
251 lines (231 loc) · 8.29 KB
/
Cargo.toml
File metadata and controls
251 lines (231 loc) · 8.29 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
[package]
name = "warden"
authors = ["Adolar0042"]
version = "1.2.8"
license = "GPL-3.0"
edition = "2024"
description = "A CLI for Git profiles and OAuth credentials, with rule-based profile selection and a built-in git credential helper."
repository = "https://github.com/adolar0042/warden"
keywords = ["git", "oauth", "credential", "helper", "cli"]
categories = ["command-line-utilities", "development-tools", "version-control"]
[dependencies]
anyhow = { version = "1.0", features = ["backtrace"] }
clap = { version = "4.5", features = ["derive", "env"] }
config = { version = "0.15", features = ["toml"] }
oauth2 = "5.0"
open = "5.3"
reqwest = { version = "0.12", features = ["json"] }
serde = "1.0"
tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "std"] }
dirs = "6.0"
constant_time_eq = "0.4"
serde_json = "1.0"
colored = "3.0"
keyring = { version = "3.6", features = [
"linux-native-sync-persistent",
"windows-native",
"apple-native",
"crypto-rust",
] }
clap_complete = "4.5"
regex = "1.11"
serde_with = "3.14"
serde_regex = "1.1"
url = "2.5"
toml = "0.9"
git2 = "0.20"
dialoguer = { version = "0.12", features = ["fuzzy-select"] }
crossterm = "0.29"
ctrlc = "3.4"
chrono = "0.4"
fuzzy-matcher = "0.3"
zeroize = { version = "1.8", features = ["derive"] }
qr2term = "0.3"
qrcode = { version = "0.14", default-features = false }
[features]
default = []
vendored = [
"git2/vendored-libgit2",
"git2/vendored-openssl",
"keyring/vendored",
"reqwest/rustls-tls",
]
[[bin]]
name = "warden"
path = "src/main.rs"
# optimise release builds as much as possible
[profile.release]
strip = true
lto = true
codegen-units = 1
incremental = true
# speed up debug builds
[profile.dev]
incremental = true
#### lints ####
[lints.rustdoc]
# it is usually sufficient to include the README
missing_crate_level_docs = "warn"
unescaped_backticks = "warn"
[lints.clippy]
# enable all lints but:
# - selectively *enable* rules from `restriction`
# - selectively *disable* other rules that are annoying
pedantic = { priority = -1, level = "warn" }
nursery = { priority = -1, level = "warn" }
cargo = { priority = -1, level = "warn" }
## ENABLED
# Rust Analyzer's "fill match arms" code action is bugged and will not use "Self",
# so temporarily turn it off until that issue gets resolved
use_self = "allow"
# sometimes it can be more readable not to inline format!() args
uninlined_format_args = "allow"
# we don't want to mark everything with #[must_use]
must_use_candidate = "allow"
# if we mark functions with "const", we're limiting what changes
# we can make to the function without breaking the "const" contract
# we may not always want to do that
missing_const_for_fn = "allow"
# we're not a crate: documenting all errors is not necessary
missing_errors_doc = "allow"
# placing an arbitrary limit on how many lines we can have is unnecessary
# if we have a function that's 300 lines long we should probably split it, right?
# but what if there's not really a good place to split it. Placing a piece of code
# into a function creates an extra abstraction. Each abstraction has a mental cost.
too_many_lines = "allow"
# it can't detect if the code has a condition to stop the iterator
maybe_infinite_iter = "allow"
# we have dependencies, so this happens
multiple-crate-versions = "allow"
## DISABLED
# === Restrictions ===
# == safety ==
# unsafe blocks need to have their invariants upheld
undocumented_unsafe_blocks = "warn"
unnecessary_safety_comment = "warn"
unnecessary_safety_doc = "warn"
# each `unsafe` block must just have 1 unsafe operation
multiple_unsafe_ops_per_block = "warn"
# not specifying representation may cause UB
default_union_representation = "warn"
# == correctness ==
# Program may behave unexpectedly
# usually creating a directory including all of its parents is the desired behaviour
create_dir = "warn"
# is_file doesn't cover special file types nor symlinks
filetype_is_file = "warn"
# may cause memory leaks
mem_forget = "warn"
# removes valuable information
assertions_on_result_states = "warn"
# The conversion might include a dangerous cast that might go undetected due to the type being inferred.
as_pointer_underscore = "warn"
# its better to be specific
as_underscore = "warn"
# bloats the binary size with unneeded files
doc_include_without_cfg = "warn"
# casting a function to a pointer is likely a mistake
fn_to_numeric_cast_any = "warn"
# "exact" float value that cannot be represented
lossy_float_literal = "warn"
# new enum variants added by the library updates can be missed
wildcard_enum_match_arm = "warn"
# == performance ==
# type information is valuable, lets not lose it
non_zero_suggestions = "warn"
mutex_atomic = "warn"
rc_mutex = "warn"
rc_buffer = "warn"
# prefer using pattern matching
string_lit_chars_any = "warn"
# == readability ==
# functional path composition is nice
pathbuf_init_then_push = "warn"
# must use e.g. 123_i32 instead of 123i32
unseparated_literal_suffix = "warn"
# Foo { a: _, b, c: _ } => Foo { b, .. }
unneeded_field_pattern = "warn"
# use std::io::{self} => use std::io
unnecessary_self_imports = "warn"
# Err(x)? => return Err(x)
try_err = "warn"
# (0..3).map(|_| x) => iter::repeat(x).take(3)
map_with_unused_argument_over_ranges = "warn"
# better be explicit with .clone()
implicit_clone = "warn"
# no need to be extra verbose, and makes code easier to modify as well
redundant_type_annotations = "warn"
# having multiple layout styles can be confusing
# I prefer mod.rs because the whole module is encapsulated in 1 directory
# instead of a my_module/ and a my_module.rs, which is 1 file + 1 directory
# always use: mod.rs
self_named_module_files = "warn"
# having an explicit, even if just containing a comment,
# "else" branch improves readability
else_if_without_else = "warn"
# explicit annotation of ! for functions that never return
# due to having infinite loops
infinite_loop = "warn"
# for consistency: { x }; => { x; }
semicolon_inside_block = "warn"
# idiomatic to put tests into #[cfg(test)]
tests_outside_test_module = "warn"
# #[allow] => #[expect]
allow_attributes = "warn"
# always must specify a reason why we're opting out of a lint
allow_attributes_without_reason = "warn"
# do not use raw strings if we don't have to
needless_raw_strings = "warn"
# makes for confusing code
mixed_read_write_in_expression = "warn"
# when panicking its important to know what happened and why,
# and a helpful message helps a LOT with that.
missing_assert_message = "warn"
# using index [] is more clear and concise
get_unwrap = "warn"
if_then_some_else_none = "warn"
# turbofish ::<> can't be used to specify the type of an impl Trait parameter
impl_trait_in_params = "warn"
# throws away the error
map_err_ignore = "warn"
# explicit imports
alloc_instead_of_core = "warn"
# may give the impression that we have more test coverage than what we have in reality
cfg_not_test = "warn"
# Rc::clone($expr) is way better than $expr.clone(), when we see `.clone()`
# we instantly might think "expensive". But cloning a pointer isn't. It's
# good to be explicit
clone_on_ref_ptr = "warn"
# more readable to use hex literals sometimes
decimal_literal_representation = "warn"
# instead use: Infallible {} => !
empty_enums = "warn"
# enum A { B(), C } => enum A { B, C }
empty_enum_variants_with_brackets = "warn"
# struct A() => struct A
empty_structs_with_brackets = "warn"
# having error types named Error can be confusing
error_impl_error = "warn"
# use x86_intel instead
inline_asm_x86_att_syntax = "warn"
# splitting the implementation for a type makes code harder to navigate
multiple_inherent_impl = "warn"
# pub(in super) => pub(super)
pub_without_shorthand = "warn"
# use the same name as the trait method's default names when implement the trait
renamed_function_params = "warn"
# unnecessary pattern binding can be confusing
# example: A { a, .. } => A { a } where A = struct A { a: usize }
rest_pat_in_fully_bound_structs = "warn"
# same name from a trait and one not from a trait can be confusing
same_name_method = "warn"
# more explicit and avoids polluting the scope
# example: use std::io::Write => use std::io::Write as _ if Write only used for its methods
unused_trait_names = "warn"
# simpler and more obvious deref:
# example: &vec[..] => &*vec
deref_by_slicing = "warn"
# use fs::read instead of intermediate values
verbose_file_reads = "warn"