@@ -55,10 +55,8 @@ use diagnostic_shim::*;
5555///
5656/// To implement `AsChangeset` this derive needs to know the corresponding table
5757/// type. By default it uses the `snake_case` type name with an added `s`.
58+ /// In this case the module for that table must be in scope.
5859/// It is possible to change this default by using `#[table_name = "something"]`.
59- /// In both cases the module for that table must be in scope.
60- /// For example, to derive this for a struct called `User`, you will
61- /// likely need a line such as `use schema::users;`
6260///
6361/// If a field name of your struct differs
6462/// from the name of the corresponding column, you can annotate the field with
@@ -78,7 +76,7 @@ use diagnostic_shim::*;
7876/// `Option::<T>::None` is just skipped. To insert a `NULL` using default
7977/// behavior use `Option::<Option<T>>::Some(None)`
8078/// * `#[table_name = "some_table"]`, specifies the table for which the
81- /// current type is a changeset. Requires that `some_table` is in scope.
79+ /// current type is a changeset.
8280/// If this attribute is not used, the type name converted to
8381/// `snake_case` with an added `s` is used as table name
8482///
@@ -149,7 +147,7 @@ pub fn derive_as_expression(input: TokenStream) -> TokenStream {
149147/// # Optional container attributes
150148///
151149/// * `#[table_name = "some_table_name"]` specifies the table this
152- /// type belongs to. Requires that `some_table_name` is in scope.
150+ /// type belongs to.
153151/// If this attribute is not used, the type name converted to
154152/// `snake_case` with an added `s` is used as table name
155153///
@@ -194,9 +192,6 @@ pub fn derive_from_sql_row(input: TokenStream) -> TokenStream {
194192/// If your table name does not follow this convention
195193/// or the plural form isn't just an `s`,
196194/// you can specify the table name with `#[table_name = "some_table_name"]`.
197- /// In both cases the module for that table must be in scope.
198- /// For example, to derive this for a struct called `User`, you will
199- /// likely need a line such as `use schema::users;`
200195/// Our rules for inferring table names is considered public API.
201196/// It will never change without a major version bump.
202197///
@@ -205,7 +200,7 @@ pub fn derive_from_sql_row(input: TokenStream) -> TokenStream {
205200/// ## Optional container attributes
206201///
207202/// * `#[table_name = "some_table_name"]` specifies the table this
208- /// type belongs to. Requires that `some_table_name` is in scope.
203+ /// type belongs to.
209204/// If this attribute is not used, the type name converted to
210205/// `snake_case` with an added `s` is used as table name
211206/// * `#[primary_key(id1, id2)]` to specify the struct field that
@@ -220,10 +215,8 @@ pub fn derive_identifiable(input: TokenStream) -> TokenStream {
220215///
221216/// To implement `Insertable` this derive needs to know the corresponding table
222217/// type. By default it uses the `snake_case` type name with an added `s`.
218+ /// In this case the module for that table must be in scope.
223219/// It is possible to change this default by using `#[table_name = "something"]`.
224- /// In both cases the module for that table must be in scope.
225- /// For example, to derive this for a struct called `User`, you will
226- /// likely need a line such as `use schema::users;`
227220///
228221/// If a field name of your
229222/// struct differs from the name of the corresponding column,
@@ -251,7 +244,7 @@ pub fn derive_identifiable(input: TokenStream) -> TokenStream {
251244/// ## Optional container attributes
252245///
253246/// * `#[table_name = "some_table_name"]`, specifies the table this type
254- /// is insertable into. Requires that `some_table_name` is in scope.
247+ /// is insertable into.
255248/// If this attribute is not used, the type name converted to
256249/// `snake_case` with an added `s` is used as table name
257250///
@@ -560,10 +553,6 @@ pub fn derive_queryable(input: TokenStream) -> TokenStream {
560553/// `diesel::dsl::SqlTypeOf<table_name::column_name>`), or by annotating each
561554/// field with `#[sql_type = "SomeType"]`.
562555///
563- /// If you are using `#[table_name]`, the module for that table must be in
564- /// scope. For example, to derive this for a struct called `User`, you will
565- /// likely need a line such as `use schema::users;`
566- ///
567556/// If the name of a field on your struct is different than the column in your
568557/// `table!` declaration, or if you are deriving this trait on a tuple struct,
569558/// you can annotate the field with `#[column_name = "some_column"]`. For tuple
0 commit comments