Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upembed_migrations! warning: unused import: `EmbedMigrations` #1739
Comments
This comment has been minimized.
|
Can you provide a minimal crate to reproduce the issue? Can you also provide the output of building with |
added a commit
to pjenvey/diesel1739
that referenced
this issue
May 31, 2018
This comment has been minimized.
pjenvey
commented
May 31, 2018
|
Minimal crate: https://github.com/pjenvey/diesel1739 Not sure the external-macro-backtrace is too helpful here:
|
This comment has been minimized.
|
cargo expand: #![feature(prelude_import)]
#![no_std]
#[prelude_import]
use std::prelude::v1::*;
extern crate diesel;
#[macro_use]
extern crate diesel_migrations;
#[macro_use]
extern crate std;
fn main() {
::io::_print(::std::fmt::Arguments::new_v1(
&["Hello, world!\n"],
&match () {
() => [],
},
));
}
#[allow(dead_code)]
mod embedded_migrations {
struct _Dummy;
extern crate diesel;
extern crate diesel_migrations;
use self::diesel_migrations::*;
use self::diesel::migration::*;
use self::diesel::connection::SimpleConnection;
use std::io;
const ALL_MIGRATIONS: &[&Migration] =
&[&EmbeddedMigration{version: "20180220220249",
up_sql:
"CREATE TABLE broadcastsv1 (\n broadcaster_id VARCHAR(64) NOT NULL,\n bchannel_id VARCHAR(128) NOT NULL,\n created TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,\n last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL,\n version VARCHAR(200) NOT NULL,\n PRIMARY KEY(broadcaster_id, bchannel_id)\n);\n",}];
struct EmbeddedMigration {
version: &'static str,
up_sql: &'static str,
}
impl Migration for EmbeddedMigration {
fn version(&self) -> &str {
self.version
}
fn run(&self, conn: &SimpleConnection) -> Result<(), RunMigrationsError> {
conn.batch_execute(self.up_sql).map_err(Into::into)
}
fn revert(&self, _conn: &SimpleConnection) -> Result<(), RunMigrationsError> {
{
{
::rt::begin_panic(
"internal error: entered unreachable code",
&("src/main.rs", 10u32, 1u32),
)
}
}
}
}
pub fn run<C: MigrationConnection>(conn: &C) -> Result<(), RunMigrationsError> {
run_with_output(conn, &mut io::sink())
}
pub fn run_with_output<C: MigrationConnection>(
conn: &C,
out: &mut io::Write,
) -> Result<(), RunMigrationsError> {
run_migrations(conn, ALL_MIGRATIONS.iter().map(|v| *v), out)
} |
added a commit
that referenced
this issue
Jun 1, 2018
sgrif
closed this
in
#1750
Jun 2, 2018
This comment has been minimized.
rockstar
commented
Aug 15, 2018
|
Can we cut a release of diesel_migrations so that this change is in a released version? |
weiznich
referenced this issue
Aug 27, 2018
Closed
Unused import `EmbedMigrations` from `embed_migrations!()` #1828
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pjenvey commentedMay 29, 2018
Beginning w/ diesel 1.3 (seen on rust 1.26.0 stable), the embed_migrations! macro produces a rustc warning:
(A couple others on the gitter have also reported seeing it)