Fixed formatting
This commit is contained in:
parent
973f0a5bae
commit
0b3fbb5533
|
@ -206,10 +206,10 @@ impl<'a> Container<'a> {
|
||||||
let self_ty = &self.path;
|
let self_ty = &self.path;
|
||||||
if let Some(ident) = field_ident {
|
if let Some(ident) = field_ident {
|
||||||
let error_msg = format!(
|
let error_msg = format!(
|
||||||
"failed to extract field {}.{}",
|
"failed to extract field {}.{}",
|
||||||
quote!(#self_ty),
|
quote!(#self_ty),
|
||||||
quote!(#ident)
|
quote!(#ident)
|
||||||
);
|
);
|
||||||
quote!(
|
quote!(
|
||||||
Ok(#self_ty{#ident: obj.extract().map_err(|inner| {
|
Ok(#self_ty{#ident: obj.extract().map_err(|inner| {
|
||||||
let err_msg = format!("{}\n\nCaused by:\n {}\n",
|
let err_msg = format!("{}\n\nCaused by:\n {}\n",
|
||||||
|
@ -219,7 +219,7 @@ impl<'a> Container<'a> {
|
||||||
})?})
|
})?})
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
let error_msg = format!("failed to extract inner field of {}", quote!(#self_ty));
|
let error_msg = format!("failed to extract inner field of {}", quote!(#self_ty));
|
||||||
quote!(Ok(#self_ty(obj.extract().map_err(|inner| {
|
quote!(Ok(#self_ty(obj.extract().map_err(|inner| {
|
||||||
let err_msg = format!("{}\n\nCaused by:\n {}\n",
|
let err_msg = format!("{}\n\nCaused by:\n {}\n",
|
||||||
#error_msg,
|
#error_msg,
|
||||||
|
@ -269,7 +269,8 @@ impl<'a> Container<'a> {
|
||||||
FieldGetter::GetItem(Some(key)) => quote!(get_item(#key)),
|
FieldGetter::GetItem(Some(key)) => quote!(get_item(#key)),
|
||||||
FieldGetter::GetItem(None) => quote!(get_item(stringify!(#ident))),
|
FieldGetter::GetItem(None) => quote!(get_item(stringify!(#ident))),
|
||||||
};
|
};
|
||||||
let conversion_error_msg = format!("failed to extract field {}.{}", quote!(#self_ty), ident);
|
let conversion_error_msg =
|
||||||
|
format!("failed to extract field {}.{}", quote!(#self_ty), ident);
|
||||||
let get_field = quote!(obj.#getter?);
|
let get_field = quote!(obj.#getter?);
|
||||||
let extractor = match &attrs.from_py_with {
|
let extractor = match &attrs.from_py_with {
|
||||||
None => quote!(#get_field.extract().map_err(|inner| {
|
None => quote!(#get_field.extract().map_err(|inner| {
|
||||||
|
|
|
@ -248,7 +248,6 @@ fn test_transparent_struct_error_message() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, FromPyObject)]
|
#[derive(Debug, FromPyObject)]
|
||||||
pub enum Foo<'a> {
|
pub enum Foo<'a> {
|
||||||
TupleVar(usize, String),
|
TupleVar(usize, String),
|
||||||
|
|
Loading…
Reference in a new issue