New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unused import #1257

Closed
jethrogb opened this Issue Oct 11, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@jethrogb
Contributor

jethrogb commented Oct 11, 2017

Problem Description

This code:

#[macro_use] extern crate diesel_codegen;
#[macro_use] extern crate diesel;

table! (config ( key ) {
    key -> ::diesel::types::Text,
    value -> ::diesel::types::Binary,
});

#[derive(Queryable, Insertable, Identifiable, AsChangeset, Debug)]
#[table_name="config"]
#[primary_key(key)]
pub struct Config {
    pub key: String,
    pub value: Vec<u8>,
}

results in the following lints:

warning: unused import
 --> src/main.rs:4:1
  |
4 | / table! (config ( key ) {
5 | |     key -> ::diesel::types::Text,
6 | |     value -> ::diesel::types::Binary,
7 | | });
  | |___^
  |
  = note: #[warn(unused_imports)] on by default
  = note: this error originates in a macro outside of the current crate

warning: unused import
 --> src/main.rs:4:1
  |
4 | / table! (config ( key ) {
5 | |     key -> ::diesel::types::Text,
6 | |     value -> ::diesel::types::Binary,
7 | | });
  | |___^
  |
  = note: this error originates in a macro outside of the current crate

Setup

Versions

  • Rust: nightly
  • Diesel: 0.16.0

Feature Flags

  • diesel: default
  • diesel_codegen: default
@Eijebong

This comment has been minimized.

Member

Eijebong commented Oct 11, 2017

Yeah, you can just do

key -> Text,
value -> Binary

if you're not using any use statement in the table! call, we stick a use diesel::types::* in there, hence the warning.

@Eijebong Eijebong closed this Oct 11, 2017

@jethrogb

This comment has been minimized.

Contributor

jethrogb commented Oct 11, 2017

Cool, should've read the changelog better I suppose 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment