Skip to content

Commit c16ab9c

Browse files
committed
Add clippy to infer schema crate
Oops, totally forgot about that one!
1 parent 4885f61 commit c16ab9c

6 files changed

Lines changed: 24 additions & 2 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ matrix:
4343
- (cd diesel && cargo rustc --no-default-features --features "lint unstable chrono serde_json uuid sqlite postgres mysql" -- -Zno-trans)
4444
- (cd diesel_cli && cargo rustc --no-default-features --features "lint sqlite postgres mysql" -- -Zno-trans)
4545
- (cd diesel_codegen && cargo rustc --no-default-features --features "lint dotenv sqlite postgres mysql" -- -Zno-trans)
46+
- (cd diesel_infer_schema && cargo rustc --no-default-features --features "lint dotenv sqlite postgres mysql" -- -Zno-trans)
4647
env:
4748
matrix:
4849
- BACKEND=sqlite

diesel_infer_schema/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ keywords = ["orm", "database", "postgres", "postgresql", "sql"]
1313
diesel = { version = "0.10.0", default-features = false }
1414
syn = "0.11.4"
1515
quote = "0.3.1"
16+
clippy = { optional = true, version = "=0.0.114" }
1617

1718
[dev-dependencies]
1819
dotenv = "0.8.0"
@@ -23,3 +24,4 @@ postgres = ["diesel/postgres", "uses_information_schema"]
2324
sqlite = ["diesel/sqlite"]
2425
mysql = ["diesel/mysql", "uses_information_schema"]
2526
uses_information_schema = []
27+
lint = ["clippy"]

diesel_infer_schema/src/information_schema.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ impl UsesInformationSchema for Mysql {
5555
}
5656
}
5757

58+
#[cfg_attr(feature = "clippy", allow(module_inception))]
5859
mod information_schema {
5960
table! {
6061
information_schema.tables (table_schema, table_name) {

diesel_infer_schema/src/lib.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
#![deny(warnings)]
1+
// Built-in Lints
2+
#![deny(warnings, missing_debug_implementations, missing_copy_implementations)]
3+
4+
// Clippy lints
5+
#![cfg_attr(feature = "clippy", allow(unstable_features))]
6+
#![cfg_attr(feature = "clippy", feature(plugin))]
7+
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file="../clippy.toml")))]
8+
#![cfg_attr(feature = "clippy", allow(
9+
option_map_unwrap_or_else, option_map_unwrap_or,
10+
match_same_arms, type_complexity,
11+
))]
12+
#![cfg_attr(feature = "clippy", warn(
13+
option_unwrap_used, result_unwrap_used, print_stdout, wrong_pub_self_convention,
14+
mut_mut, non_ascii_literal, similar_names, unicode_not_nfc,
15+
enum_glob_use, if_not_else, items_after_statements, used_underscore_binding,
16+
))]
17+
#![cfg_attr(all(test, feature = "clippy"), allow(result_unwrap_used))]
218

319
#[macro_use]
420
extern crate quote;

diesel_infer_schema/src/mysql.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn determine_type_name(sql_type_name: &str) -> &str {
2020
} else if let Some(idx) = sql_type_name.find('(') {
2121
&sql_type_name[..idx]
2222
} else {
23-
&sql_type_name
23+
sql_type_name
2424
}
2525
}
2626

diesel_infer_schema/src/table_data.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ impl fmt::Display for TableData {
5050
}
5151

5252
#[derive(Debug)]
53+
#[allow(missing_copy_implementations)]
5354
pub enum Never {}
55+
5456
impl FromStr for TableData {
5557
type Err = Never;
5658

0 commit comments

Comments
 (0)