Skip to content

Commit 3426e02

Browse files
committed
chore: disallow e binding name
1 parent 318513f commit 3426e02

File tree

10 files changed

+29
-19
lines changed

10 files changed

+29
-19
lines changed

.clippy.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
disallowed-names = [
2+
"foo", # placeholder name
3+
"baz", # placeholder name
4+
"quux", # placeholder name
5+
"e", # prefer `err`
6+
]

Cargo.toml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ license = "MIT"
88
edition = "2021"
99
rust-version = "1.80"
1010

11-
[workspace.lints.rust]
12-
rust_2018_idioms = "deny"
13-
nonstandard_style = "deny"
14-
future_incompatible = "deny"
15-
missing_debug_implementations = { level = "warn", priority = -1 }
16-
1711
[workspace.dependencies]
1812
assert_matches = "1"
1913
bytes = "1.10"
@@ -46,3 +40,13 @@ url = "2"
4640
[patch.crates-io]
4741
oas3 = { path = "crates/oas3" }
4842
roast = { path = "crates/roast" }
43+
44+
[workspace.lints.rust]
45+
rust-2018-idioms = "deny"
46+
nonstandard-style = "deny"
47+
future-incompatible = "deny"
48+
missing-debug-implementations = { level = "warn", priority = -1 }
49+
50+
[workspace.lints.clippy]
51+
uninlined-format-args = "warn"
52+
disallowed-names = "warn"

crates/oas3/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ mod tests {
8484
where
8585
P: AsRef<Path> + std::fmt::Debug,
8686
{
87-
println!(" Saving string to {:?}...", path);
87+
println!(" Saving string to {path:?}...");
8888
std::fs::create_dir_all(&path).unwrap();
8989
let full_filename = path.as_ref().to_path_buf().join(filename);
9090
let mut f = File::create(full_filename).unwrap();
@@ -119,7 +119,7 @@ mod tests {
119119

120120
// Read the original file to string
121121
let spec_yaml_str = read_to_string(input_file)
122-
.unwrap_or_else(|e| panic!("failed to read contents of {:?}: {}", input_file, e));
122+
.unwrap_or_else(|err| panic!("failed to read contents of {input_file:?}: {err}"));
123123
// Convert YAML string to JSON string
124124
let spec_json_str = convert_yaml_str_to_json(&spec_yaml_str);
125125

@@ -164,7 +164,7 @@ mod tests {
164164
let entry = entry.unwrap();
165165
let path = entry.path();
166166

167-
println!("Testing if {:?} is deserializable", path);
167+
println!("Testing if {path:?} is deserializable");
168168

169169
let (api_filename, parsed_spec_json_str, spec_json_str) =
170170
compare_spec_through_json(&path, &save_path_base);

crates/oas3/src/spec/media_type_examples.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl MediaTypeExamples {
7373
.filter_map(|(name, oor)| {
7474
oor.resolve(spec)
7575
.map(|obj| (name.clone(), obj))
76-
.map_err(|err| error!("{}", err))
76+
.map_err(|err| error!("{err}"))
7777
.ok()
7878
})
7979
.collect(),

crates/oas3/src/spec/operation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl Operation {
146146
oor.resolve(spec)
147147
.map(|obj| (name.clone(), obj))
148148
// TODO: find better error solution
149-
.map_err(|err| error!("{}", err))
149+
.map_err(|err| error!("{err}"))
150150
.ok()
151151
})
152152
.collect()
@@ -158,7 +158,7 @@ impl Operation {
158158
.parameters
159159
.iter()
160160
// TODO: find better error solution, maybe vec<result<_>>
161-
.filter_map(|oor| oor.resolve(spec).map_err(|err| error!("{}", err)).ok())
161+
.filter_map(|oor| oor.resolve(spec).map_err(|err| error!("{err}")).ok())
162162
.collect();
163163

164164
Ok(params)

crates/roast/src/conformance/auth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl fmt::Debug for TestAuthentication {
4242
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
4343
match self {
4444
Self::Custom(_) => write!(f, "[custom auth transformer]"),
45-
other => write!(f, "{:?}", other),
45+
other => write!(f, "{other:?}"),
4646
}
4747
}
4848
}

crates/roast/src/conformance/runner.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl TestRunner {
165165
.map(|(test_spec, test)| {
166166
let num = Arc::clone(&num).fetch_sub(1, Ordering::SeqCst);
167167

168-
println!("running test: {}", num);
168+
println!("running test: {num}");
169169
trace!("run test: {:?}", &test);
170170

171171
self.run_test(test).map(|result| (test_spec, result))
@@ -198,7 +198,7 @@ impl TestRunner {
198198
let test_desc = if let Some(name) = &test.name {
199199
let test_name = name.yellow();
200200
let op_spec = op.to_string().italic();
201-
format!("{}\n{}", test_name, op_spec)
201+
format!("{test_name}\n{op_spec}")
202202
} else {
203203
let op_spec = op.to_string().italic();
204204
op_spec.to_string()

crates/roast/src/conformance/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ impl ConformanceTestSpec {
207207
};
208208

209209
if let Some(TestAuthentication::Bearer(ref jwt)) = self.request.auth {
210-
let val = format!("Bearer {}", jwt);
210+
let val = format!("Bearer {jwt}");
211211
req.headers
212212
.insert("Authorization", val.parse().expect("invalid auth token"));
213213
}

crates/roast/src/validation/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl fmt::Display for AggregateError {
3131
let errs = self
3232
.errors
3333
.iter()
34-
.map(|err| format!(" => {}", err))
34+
.map(|err| format!(" => {err}"))
3535
.collect::<Vec<_>>()
3636
.join("\n");
3737

crates/roast/src/validation/validator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl ValidationTree {
3737
};
3838

3939
if let Some(type_) = &schema.schema_type {
40-
trace!("restricting data type: {:?}", type_);
40+
trace!("restricting data type: {type_:?}");
4141

4242
let type_val = if let Some(nullable) = schema.is_nullable() {
4343
DataType::new(type_.clone()).set_nullable(nullable)
@@ -233,7 +233,7 @@ impl ValidationTree {
233233
match val {
234234
JsonValue::Array(items) => {
235235
for (i, item) in items.iter().enumerate() {
236-
let child_path = path.extend(format!("[{}]", i));
236+
let child_path = path.extend(format!("[{i}]"));
237237
v.validate_inner(item, child_path)?;
238238
}
239239
}

0 commit comments

Comments
 (0)