Generate qualified Result type in derive (#430)

This commit is contained in:
Andre Nathan 2021-11-05 14:07:13 -03:00 committed by GitHub
parent e54a47cf14
commit 7174f6422d
2 changed files with 5 additions and 5 deletions

View File

@ -97,7 +97,7 @@ impl DeriveEnum {
.generate_fn("borrow_decode")
.with_generic("D", ["bincode::de::BorrowDecoder<'__de>"])
.with_arg("mut decoder", "D")
.with_return_type("Result<Self, bincode::error::DecodeError>")
.with_return_type("core::result::Result<Self, bincode::error::DecodeError>")
.body(|fn_builder| {
fn_builder
.push_parsed("let variant_index = <u32 as bincode::de::Decode>::decode(&mut decoder)?;").unwrap();
@ -147,7 +147,7 @@ impl DeriveEnum {
.generate_fn("decode")
.with_generic("D", ["bincode::de::Decoder"])
.with_arg("mut decoder", "D")
.with_return_type("Result<Self, bincode::error::DecodeError>")
.with_return_type("core::result::Result<Self, bincode::error::DecodeError>")
.body(|fn_builder| {
fn_builder
.push_parsed("let variant_index = <u32 as bincode::de::Decode>::decode(&mut decoder)?;").unwrap();

View File

@ -18,7 +18,7 @@ impl DeriveStruct {
.with_generic("E", ["bincode::enc::Encoder"])
.with_self_arg(crate::generate::FnSelfArg::RefSelf)
.with_arg("mut encoder", "E")
.with_return_type("Result<(), bincode::error::EncodeError>")
.with_return_type("core::result::Result<(), bincode::error::EncodeError>")
.body(|fn_body| {
for field in fields.names() {
fn_body
@ -47,7 +47,7 @@ impl DeriveStruct {
.generate_fn("borrow_decode")
.with_generic("D", ["bincode::de::BorrowDecoder<'__de>"])
.with_arg("mut decoder", "D")
.with_return_type("Result<Self, bincode::error::DecodeError>")
.with_return_type("core::result::Result<Self, bincode::error::DecodeError>")
.body(|fn_body| {
// Ok(Self {
fn_body.ident_str("Ok");
@ -77,7 +77,7 @@ impl DeriveStruct {
.generate_fn("decode")
.with_generic("D", ["bincode::de::Decoder"])
.with_arg("mut decoder", "D")
.with_return_type("Result<Self, bincode::error::DecodeError>")
.with_return_type("core::result::Result<Self, bincode::error::DecodeError>")
.body(|fn_body| {
// Ok(Self {
fn_body.ident_str("Ok");