diff --git a/serde_derive/src/internals/ast.rs b/serde_derive/src/internals/ast.rs index 305d5f06..bb2c4690 100644 --- a/serde_derive/src/internals/ast.rs +++ b/serde_derive/src/internals/ast.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! A serde ast, parsed from the syn ast and ready for codegen. +//! A serde ast, parsed from the syn ast and ready to generate rust code. use internals::attr; use internals::check; @@ -14,7 +14,7 @@ use internals::{Ctxt, Derive}; use syn; use syn::punctuated::Punctuated; -/// A source data structure annotated with `#[derive(Derialize)]` and/or `#[derive(Deserialize)]`, +/// A source data structure annotated with `#[derive(Serialize)]` and/or `#[derive(Deserialize)]`, /// parsed into an internal representation. pub struct Container<'a> { /// The struct or enum name (without generics). @@ -43,7 +43,7 @@ pub struct Variant<'a> { pub fields: Vec>, } -/// A variant of a struct. +/// A field of a struct. pub struct Field<'a> { pub member: syn::Member, pub attrs: attr::Field, diff --git a/serde_derive/src/internals/case.rs b/serde_derive/src/internals/case.rs index e5162ca9..87428144 100644 --- a/serde_derive/src/internals/case.rs +++ b/serde_derive/src/internals/case.rs @@ -6,8 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! Stuff to handle where the case of the source (e.g. `my-field`) is different to the -//! field/variant (e.g. `my_field`). +//! Utility code to assist converting the case of the source (e.g. `my-field`, `MY_FIELD`) to the +//! rust-styled field/variant (e.g. `my_field`, `MyType`). // See https://users.rust-lang.org/t/psa-dealing-with-warning-unused-import-std-ascii-asciiext-in-today-s-nightly/13726 #[allow(deprecated, unused_imports)] diff --git a/serde_derive/src/internals/ctxt.rs b/serde_derive/src/internals/ctxt.rs index 5aa6bbdb..51c72f7c 100644 --- a/serde_derive/src/internals/ctxt.rs +++ b/serde_derive/src/internals/ctxt.rs @@ -23,14 +23,16 @@ pub struct Ctxt { } impl Ctxt { - /// Create a new context object + /// Create a new context object. + /// + /// This object contains no errors, but will still trigger a panic if it is not `check`ed. pub fn new() -> Self { Ctxt { errors: RefCell::new(Some(Vec::new())), } } - /// Add an error to the context object + /// Add an error to the context object. pub fn error(&self, msg: T) { self.errors .borrow_mut()