Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/codegen/from_derive_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl ToTokens for FromDeriveInputImpl<'_> {
Some(p) => p.clone(),
None => parse_quote_spanned!(i.ty.span()=> _darling::export::TryFrom::try_from),
})
.unwrap_or_else(|| parse_quote!(_darling::export::Ok));
.unwrap_or_else(|| parse_quote!(_darling::Result::Ok));

let supports = self.supports;
let validate_and_read_data = {
Expand Down
2 changes: 1 addition & 1 deletion core/src/codegen/from_variant_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl ToTokens for FromVariantImpl<'_> {
Some(p) => p.clone(),
None => parse_quote_spanned!(i.ty.span()=> _darling::ast::Fields::try_from),
})
.unwrap_or_else(|| parse_quote!(_darling::export::Ok));
.unwrap_or_else(|| parse_quote!(_darling::Result::Ok));

let supports = self
.supports
Expand Down
7 changes: 4 additions & 3 deletions core/src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -828,12 +828,13 @@ impl Accumulator {

/// Handles a possible error.

@nik-rev nik-rev Jan 16, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a more concise doc for this function could be:

/// Extracts the `Ok` value, otherwise handles the error

///
/// Returns a successful value as `Some`, or collects the error and returns `None`.
pub fn handle<T>(&mut self, result: Result<T>) -> Option<T> {
/// Returns a successful value as `Some`, or collects the error,
/// converts it to `darling::Error`, and returns `None`.
pub fn handle<T, E: Into<Error>>(&mut self, result: std::result::Result<T, E>) -> Option<T> {
match result {
Ok(y) => Some(y),
Err(e) => {
self.push(e);
self.push(e.into());
None
}
}
Expand Down
Loading