Skip to content

Commit

Permalink
Merge pull request #1789 from diesel-rs/sg-bump-nightly
Browse files Browse the repository at this point in the history
Update to nightly-2018-07-17
  • Loading branch information
sgrif authored Jul 19, 2018
2 parents 68d0b9e + 55e3894 commit 765b782
Show file tree
Hide file tree
Showing 67 changed files with 358 additions and 438 deletions.
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@ matrix:
allow_failures:
- rust: nightly
include:
- rust: nightly-2018-04-19
- rust: nightly-2018-07-17
env: CLIPPY_AND_COMPILE_TESTS=YESPLEASE
script:
- (cd diesel && cargo rustc --no-default-features --features "lint sqlite postgres mysql extras" -- -Zno-trans)
- (cd diesel_cli && cargo rustc --no-default-features --features "lint sqlite postgres mysql" -- -Zno-trans)
- (cd diesel_derives && cargo rustc --no-default-features --features "lint" -- -Zno-trans)
- (cd diesel_migrations && cargo rustc --no-default-features --features "lint dotenv sqlite postgres mysql" -- -Zno-trans)
- rustup component add clippy-preview
- cargo clippy
- (cd diesel_compile_tests && travis-cargo test)
- rust: 1.26.1
env: RUSTFMT=YESPLEASE
Expand Down
24 changes: 0 additions & 24 deletions bin/check

This file was deleted.

34 changes: 16 additions & 18 deletions bin/test
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env bash
set -e

CLIPPY="lint"

if [ "$1" = "integration" ]; then
if [ "$2" ]; then
BACKEND="$2"
Expand All @@ -14,32 +12,32 @@ if [ "$1" = "integration" ]; then
if [ "$BACKEND" = "mysql" ]; then
export RUST_TEST_THREADS=1
fi
(cd diesel_tests && cargo test --features "$CLIPPY $BACKEND" --no-default-features $*)
(cd diesel_tests && cargo test --features "$BACKEND" --no-default-features $*)
elif [ "$1" = "compile" ]; then
shift
(cd diesel_compile_tests && cargo test $*)
else
(cd diesel && cargo test --no-default-features --features "$CLIPPY extras sqlite postgres mysql" $*)
(cd diesel && cargo test --no-default-features --features "extras sqlite postgres mysql" $*)

(cd diesel_cli && cargo test --features "$CLIPPY sqlite" --no-default-features $*)
(cd diesel_migrations && cargo test --features "$CLIPPY sqlite" $*)
(cd diesel_derives && cargo test --features "$CLIPPY diesel/sqlite" $*)
(cd diesel_tests && cargo test --features "$CLIPPY sqlite" --no-default-features $*)
(cd diesel_cli && cargo test --features "sqlite" --no-default-features $*)
(cd diesel_migrations && cargo test --features "sqlite" $*)
(cd diesel_derives && cargo test --features "diesel/sqlite" $*)
(cd diesel_tests && cargo test --features "sqlite" --no-default-features $*)

(cd diesel_migrations && cargo test --features "$CLIPPY postgres" $*)
(cd diesel_derives && cargo test --features "$CLIPPY diesel/postgres" $*)
(cd diesel_cli && cargo test --features "$CLIPPY postgres" --no-default-features $*)
(cd diesel_tests && cargo test --features "$CLIPPY postgres" --no-default-features $*)
(cd diesel_migrations && cargo test --features "postgres" $*)
(cd diesel_derives && cargo test --features "diesel/postgres" $*)
(cd diesel_cli && cargo test --features "postgres" --no-default-features $*)
(cd diesel_tests && cargo test --features "postgres" --no-default-features $*)

export RUST_TEST_THREADS=1
(cd diesel_migrations && cargo test --features "$CLIPPY mysql" $*)
(cd diesel_derives && cargo test --features "$CLIPPY diesel/mysql" $*)
(cd diesel_cli && cargo test --features "$CLIPPY mysql" --no-default-features $*)
(cd diesel_tests && cargo test --features "$CLIPPY mysql" --no-default-features $*)
(cd diesel_migrations && cargo test --features "mysql" $*)
(cd diesel_derives && cargo test --features "diesel/mysql" $*)
(cd diesel_cli && cargo test --features "mysql" --no-default-features $*)
(cd diesel_tests && cargo test --features "mysql" --no-default-features $*)
unset RUST_TEST_THREADS

(cd diesel_compile_tests && cargo test $*)
(cd diesel_migrations/migrations_internals && cargo test --features "$CLIPPY" $*)
(cd diesel_migrations/migrations_macros && cargo test --features "$CLIPPY" $*)
(cd diesel_migrations/migrations_internals && cargo test $*)
(cd diesel_migrations/migrations_macros && cargo test $*)
(cd examples && ./test_all $*)
fi;
2 changes: 0 additions & 2 deletions diesel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ categories = ["database"]
byteorder = "1.0"
diesel_derives = "~1.3.0"
chrono = { version = "0.4", optional = true }
clippy = { optional = true, version = "=0.0.195" }
libc = { version = "0.2.0", optional = true }
libsqlite3-sys = { version = ">=0.8.0, <0.10.0", optional = true, features = ["min_sqlite_version_3_7_16"] }
mysqlclient-sys = { version = ">=0.1.0, <0.3.0", optional = true }
Expand Down Expand Up @@ -43,7 +42,6 @@ tempdir = "^0.3.4"
default = ["with-deprecated", "32-column-tables"]
extras = ["chrono", "serde_json", "uuid", "deprecated-time", "network-address", "numeric", "r2d2"]
unstable = ["diesel_derives/nightly"]
lint = ["clippy"]
large-tables = ["32-column-tables"]
huge-tables = ["64-column-tables"]
x32-column-tables = ["32-column-tables"]
Expand Down
4 changes: 2 additions & 2 deletions diesel/src/connection/statement_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub struct StatementCache<DB: Backend, Statement> {
pub cache: RefCell<HashMap<StatementCacheKey<DB>, Statement>>,
}

#[cfg_attr(feature = "clippy", allow(len_without_is_empty, new_without_default_derive))]
#[cfg_attr(feature = "cargo-clippy", allow(len_without_is_empty, new_without_default_derive))]
impl<DB, Statement> StatementCache<DB, Statement>
where
DB: Backend,
Expand Down Expand Up @@ -250,7 +250,7 @@ where
Ok(x) => x,
Err(e) => {
error = Some(e);
#[cfg_attr(feature = "clippy", allow(invalid_ref))]
#[cfg_attr(feature = "cargo-clippy", allow(invalid_ref))]
unsafe {
mem::uninitialized()
}
Expand Down
13 changes: 5 additions & 8 deletions diesel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,32 +130,29 @@
// Built-in Lints
#![deny(warnings, missing_debug_implementations, missing_copy_implementations, missing_docs)]
// Clippy lints
#![cfg_attr(feature = "clippy", allow(unstable_features))]
#![cfg_attr(feature = "clippy", feature(plugin))]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
#![cfg_attr(
feature = "clippy",
feature = "cargo-clippy",
allow(
option_map_unwrap_or_else, option_map_unwrap_or, match_same_arms, type_complexity,
redundant_field_names
)
)]
#![cfg_attr(
feature = "clippy",
feature = "cargo-clippy",
warn(
option_unwrap_used, result_unwrap_used, print_stdout, wrong_pub_self_convention, mut_mut,
non_ascii_literal, similar_names, unicode_not_nfc, enum_glob_use, if_not_else,
items_after_statements, used_underscore_binding
)
)]
#![cfg_attr(all(test, feature = "clippy"), allow(option_unwrap_used, result_unwrap_used))]
#![cfg_attr(all(test, feature = "cargo-clippy"), allow(option_unwrap_used, result_unwrap_used))]

#[cfg(feature = "postgres")]
#[macro_use]
extern crate bitflags;
extern crate byteorder;
// This is required to make `diesel_derives` re-export, but clippy thinks its unused
#[cfg_attr(feature = "clippy", allow(useless_attribute))]
// This is required to make `diesel_derives` re-export, but cargo-clippy thinks its unused
#[cfg_attr(feature = "cargo-clippy", allow(useless_attribute))]
#[allow(unused_imports)]
#[macro_use]
extern crate diesel_derives;
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/migration/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl From<io::Error> for MigrationError {

/// Errors that occur while running migrations
#[derive(Debug, PartialEq)]
#[cfg_attr(feature = "clippy", allow(enum_variant_names))]
#[cfg_attr(feature = "cargo-clippy", allow(enum_variant_names))]
pub enum RunMigrationsError {
/// A general migration error occured
MigrationError(MigrationError),
Expand Down
4 changes: 2 additions & 2 deletions diesel/src/mysql/connection/stmt/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct StatementIterator<'a> {
output_binds: Binds,
}

#[cfg_attr(feature = "clippy", allow(should_implement_trait))] // don't neet `Iterator` here
#[cfg_attr(feature = "cargo-clippy", allow(should_implement_trait))] // don't neet `Iterator` here
impl<'a> StatementIterator<'a> {
pub fn new(stmt: &'a mut Statement, types: Vec<(MysqlType, IsSigned)>) -> QueryResult<Self> {
let mut output_binds = Binds::from_output_types(types);
Expand Down Expand Up @@ -70,7 +70,7 @@ pub struct NamedStatementIterator<'a> {
metadata: StatementMetadata,
}

#[cfg_attr(feature = "clippy", allow(should_implement_trait))] // don't need `Iterator` here
#[cfg_attr(feature = "cargo-clippy", allow(should_implement_trait))] // don't need `Iterator` here
impl<'a> NamedStatementIterator<'a> {
pub fn new(stmt: &'a mut Statement) -> QueryResult<Self> {
let metadata = stmt.metadata()?;
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/mysql/types/date_and_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ macro_rules! mysql_time_impls {

impl FromSql<$ty, Mysql> for ffi::MYSQL_TIME {
// ptr::copy_nonoverlapping does not require aligned pointers
#[cfg_attr(feature = "clippy", allow(cast_ptr_alignment))]
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
fn from_sql(bytes: Option<&[u8]>) -> deserialize::Result<Self> {
let bytes = not_none!(bytes);
let bytes_ptr = bytes.as_ptr() as *const ffi::MYSQL_TIME;
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/pg/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl PgConnection {
TransactionBuilder::new(self)
}

#[cfg_attr(feature = "clippy", allow(type_complexity))]
#[cfg_attr(feature = "cargo-clippy", allow(type_complexity))]
fn prepare_query<T: QueryFragment<Pg> + QueryId>(
&self,
source: &T,
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/pg/connection/raw.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![cfg_attr(feature = "clippy", allow(too_many_arguments))]
#![cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]

extern crate pq_sys;

Expand Down
4 changes: 2 additions & 2 deletions diesel/src/pg/connection/stmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct Statement {
}

impl Statement {
#[cfg_attr(feature = "clippy", allow(ptr_arg))]
#[cfg_attr(feature = "cargo-clippy", allow(ptr_arg))]
pub fn execute(
&self,
conn: &RawConnection,
Expand Down Expand Up @@ -48,7 +48,7 @@ impl Statement {
PgResult::new(internal_res?)
}

#[cfg_attr(feature = "clippy", allow(ptr_arg))]
#[cfg_attr(feature = "cargo-clippy", allow(ptr_arg))]
pub fn prepare(
conn: &RawConnection,
sql: &str,
Expand Down
2 changes: 2 additions & 0 deletions diesel/src/pg/types/date_and_time/std_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ fn usecs_to_duration(usecs_passed: u64) -> Duration {
Duration::new(seconds, subseconds)
}

// FIXME: Remove this when our minimum Rust version is >= 1.27
#[cfg_attr(feature = "cargo-clippy", allow(duration_subsec))]
fn duration_to_usecs(duration: Duration) -> u64 {
let seconds = duration.as_secs() * USEC_PER_SEC;
let subseconds = duration.subsec_nanos() / NANO_PER_USEC;
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/pg/types/record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ macro_rules! tuple_impls {
// Yes, we're relying on the order of evaluation of subexpressions
// but the only other option would be to use `mem::uninitialized`
// and `ptr::write`.
#[cfg_attr(feature = "clippy", allow(eval_order_dependence))]
#[cfg_attr(feature = "cargo-clippy", allow(eval_order_dependence))]
fn from_sql(bytes: Option<&[u8]>) -> deserialize::Result<Self> {
let mut bytes = not_none!(bytes);
let num_elements = bytes.read_i32::<NetworkEndian>()?;
Expand Down
4 changes: 2 additions & 2 deletions diesel/src/query_builder/ast_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ where
DB: Backend,
{
#[doc(hidden)]
#[cfg_attr(feature = "clippy", allow(wrong_self_convention))]
#[cfg_attr(feature = "cargo-clippy", allow(wrong_self_convention))]
pub fn to_sql(query_builder: &'a mut DB::QueryBuilder) -> Self {
AstPass {
internals: AstPassInternals::ToSql(query_builder),
Expand Down Expand Up @@ -90,7 +90,7 @@ where
/// done explicitly. This method matches the semantics of what Rust would do
/// implicitly if you were passing a mutable reference
// Clippy is wrong, this cannot be expressed with pointer casting
#[cfg_attr(feature = "clippy", allow(transmute_ptr_to_ptr))]
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ptr))]
pub fn reborrow(&mut self) -> AstPass<DB> {
use self::AstPassInternals::*;
let internals = match self.internals {
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/query_builder/bind_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub struct RawBytesBindCollector<DB: Backend + TypeMetadata> {
pub binds: Vec<Option<Vec<u8>>>,
}

#[cfg_attr(feature = "clippy", allow(new_without_default_derive))]
#[cfg_attr(feature = "cargo-clippy", allow(new_without_default_derive))]
impl<DB: Backend + TypeMetadata> RawBytesBindCollector<DB> {
/// Construct an empty `RawBytesBindCollector`
pub fn new() -> Self {
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/query_builder/debug_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ where
T: QueryFragment<DB>,
{
// Clippy is wrong, this cannot be expressed with pointer casting
#[cfg_attr(feature = "clippy", allow(transmute_ptr_to_ptr))]
#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ptr))]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let mut list = f.debug_list();
{
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/query_builder/select_statement/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub struct BoxedSelectStatement<'a, ST, QS, DB> {
}

impl<'a, ST, QS, DB> BoxedSelectStatement<'a, ST, QS, DB> {
#[cfg_attr(feature = "clippy", allow(too_many_arguments))]
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
pub fn new(
select: Box<QueryFragment<DB> + 'a>,
from: QS,
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/query_builder/select_statement/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub struct SelectStatement<
}

impl<F, S, D, W, O, L, Of, G, LC> SelectStatement<F, S, D, W, O, L, Of, G, LC> {
#[cfg_attr(feature = "clippy", allow(too_many_arguments))]
#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
pub fn new(
select: S,
from: F,
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::ffi::NulError;
use std::fmt::{self, Display};

#[derive(Debug)]
#[cfg_attr(feature = "clippy", allow(enum_variant_names))]
#[cfg_attr(feature = "cargo-clippy", allow(enum_variant_names))]
/// Represents all the ways that a query can fail.
///
/// This type is not intended to be exhaustively matched, and new variants may
Expand Down
2 changes: 1 addition & 1 deletion diesel/src/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl<DB: TypeMetadata> Output<'static, Vec<u8>, DB> {
/// Unsafe to use for testing types which perform dynamic metadata lookup.
pub fn test() -> Self {
use std::mem;
#[cfg_attr(feature = "clippy", allow(invalid_ref))]
#[cfg_attr(feature = "cargo-clippy", allow(invalid_ref))]
Self::new(Vec::new(), unsafe { mem::uninitialized() })
}
}
Expand Down
4 changes: 2 additions & 2 deletions diesel/src/sqlite/connection/serialized_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct SerializedValue {
impl SerializedValue {
// We are always reading potentially misaligned pointers with
// `ptr::read_unaligned`
#[cfg_attr(feature = "clippy", allow(cast_ptr_alignment))]
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
pub(crate) fn bind_to(self, stmt: NonNull<ffi::sqlite3_stmt>, idx: libc::c_int) -> libc::c_int {
// This unsafe block assumes the following invariants:
//
Expand Down Expand Up @@ -65,7 +65,7 @@ impl SerializedValue {

// We are always reading potentially misaligned pointers with
// `ptr::read_unaligned`
#[cfg_attr(feature = "clippy", allow(cast_ptr_alignment))]
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
pub fn result_of(self, ctx: *mut ffi::sqlite3_context) {
// This unsafe block assumes the following invariants:
//
Expand Down
2 changes: 0 additions & 2 deletions diesel_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ path = "src/main.rs"
[dependencies]
chrono = "0.4"
clap = "2.27"
clippy = { optional = true, version = "=0.0.195" }
diesel = { version = "~1.3.0", default-features = false }
dotenv = ">=0.8, <0.11"
migrations_internals = "~1.3.0"
Expand All @@ -36,7 +35,6 @@ url = { version = "1.4.0" }

[features]
default = ["postgres", "sqlite", "mysql"]
lint = ["clippy"]
postgres = ["diesel/postgres", "url", "uses_information_schema"]
sqlite = ["diesel/sqlite"]
mysql = ["diesel/mysql", "url", "uses_information_schema"]
Expand Down
4 changes: 2 additions & 2 deletions diesel_cli/src/config.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// FIXME: https://github.com/rust-lang-nursery/rust-clippy/issues/2910
#![cfg_attr(feature = "clippy", allow(useless_attribute))]
// FIXME: https://github.com/rust-lang-nursery/rust-cargo-clippy/issues/2910
#![cfg_attr(feature = "cargo-clippy", allow(useless_attribute))]

use clap::ArgMatches;
use std::env;
Expand Down
4 changes: 2 additions & 2 deletions diesel_cli/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ fn create_default_migration_if_needed(
}

#[allow(unreachable_patterns)]
#[cfg_attr(feature = "clippy", allow(single_match))]
#[cfg_attr(feature = "cargo-clippy", allow(single_match))]
match Backend::for_url(database_url) {
#[cfg(feature = "postgres")]
Backend::Pg => {
Expand Down Expand Up @@ -336,7 +336,7 @@ fn change_database_of_url(database_url: &str, default_database: &str) -> (String
(database, new_url.into_string())
}

#[cfg_attr(feature = "clippy", allow(needless_pass_by_value))]
#[cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))]
fn handle_error<E: Error, T>(error: E) -> T {
println!("{}", error);
::std::process::exit(1);
Expand Down
2 changes: 2 additions & 0 deletions diesel_cli/src/infer_schema_internals/foreign_keys.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(feature = "cargo-clippy", allow(expect_fun_call))] // My calls are so fun

use super::data_structures::ForeignKeyConstraint;
use super::inference::get_primary_keys;
use super::table_data::TableName;
Expand Down
Loading

0 comments on commit 765b782

Please sign in to comment.