Skip to content

Report multiple errors from proc-macros #5159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
clippy
  • Loading branch information
jjmarchewitz committed May 19, 2025
commit 7bc9afc4411ca3fa7e64450e523b9992a1877e03
6 changes: 3 additions & 3 deletions pyo3-macros-backend/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ pub fn get_pyo3_options<T: Parse>(attr: &syn::Attribute) -> Result<Option<Punctu
/// (In `retain`, returning `true` keeps the element, here it removes it.)
pub fn take_attributes(
attrs: &mut Vec<Attribute>,
mut extractor: impl FnMut(&Attribute) -> syn::Result<bool>,
) -> syn::Result<()> {
mut extractor: impl FnMut(&Attribute) -> Result<bool>,
) -> Result<()> {
*attrs = attrs
.drain(..)
.filter_map(|attr| {
Expand All @@ -392,7 +392,7 @@ pub fn take_attributes(
Ok(())
}

pub fn take_pyo3_options<T: Parse>(attrs: &mut Vec<syn::Attribute>) -> syn::Result<Vec<T>> {
pub fn take_pyo3_options<T: Parse>(attrs: &mut Vec<syn::Attribute>) -> Result<Vec<T>> {
let mut out = Vec::new();

take_attributes(attrs, |attr| match get_pyo3_options(attr) {
Expand Down
2 changes: 0 additions & 2 deletions pyo3-macros-backend/src/combine_errors.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use syn;

pub(crate) trait CombineErrors: Iterator {
type Ok;
fn try_combine_syn_errors(self) -> syn::Result<impl Iterator<Item = Self::Ok>>;
Expand Down
2 changes: 1 addition & 1 deletion pyo3-macros-backend/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ pub fn pymodule_module_impl(
let mut module_consts = Vec::new();
let mut module_consts_cfg_attrs = Vec::new();

let _: Vec<()> = (&mut *items).into_iter().map(|item|{
let _: Vec<()> = (&mut *items).iter_mut().map(|item|{
match item {
Item::Use(item_use) => {
let is_pymodule_export =
Expand Down
2 changes: 1 addition & 1 deletion pyo3-macros-backend/src/pyimpl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub fn impl_methods(
let mut implemented_proto_fragments = HashSet::new();

let _: Vec<()> = impls
.into_iter()
.iter_mut()
.map(|iimpl| {
match iimpl {
syn::ImplItem::Fn(meth) => {
Expand Down