{"record":{"id":"df782379713d1896","repo":"GitoxideLabs/gitoxide","slug":"couldn-t-apply-a-single-conversion-momo-is-ineff","errorCode":null,"errorMessage":"Couldn't apply a single conversion - momo is ineffective here","messagePattern":"Couldn't apply a single conversion - momo is ineffective here","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-macros/src/momo.rs","lineNumber":16,"sourceCode":"use std::collections::HashMap;\n\nuse quote::quote;\nuse syn::{punctuated::Punctuated, spanned::Spanned, *};\n\npub(crate) fn inner(code: proc_macro2::TokenStream) -> proc_macro2::TokenStream {\n    let fn_item: Item = match syn::parse2(code.clone()) {\n        Ok(input) => input,\n        Err(err) => return err.to_compile_error(),\n    };\n\n    if let Item::Fn(item_fn) = fn_item {\n        let ty_conversions = parse_generics(&item_fn.sig);\n        let (has_conversion_in_effect, argtypes, argexprs, has_self) = convert(&item_fn.sig.inputs, &ty_conversions);\n        if !has_conversion_in_effect {\n            return Error::new(\n                item_fn.span(),\n                \"Couldn't apply a single conversion - momo is ineffective here\",\n            )\n            .to_compile_error();\n        }\n\n        let uses_self = has_self\n            || item_fn.sig.inputs.iter().any(has_self_type)\n            || matches!(&item_fn.sig.output, ReturnType::Type(_, ty) if contains_self_type(ty));\n\n        let inner_ident = Ident::new(\n            // Use long qualifier to avoid name collision.\n            &format!(\"_{}_inner_generated_by_gix_macro_momo\", item_fn.sig.ident),\n            proc_macro2::Span::call_site(),\n        );\n\n        let outer_sig = Signature {\n            inputs: argtypes,","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-macros/src/momo.rs#L1-L34","documentation":"The `momo` proc-macro (used for `impl Into<T>` argument conversion, as in gix's `#[gix::command_fn]`-style wrappers) rewrites a function so each argument is converted once at the boundary. If it finds no argument whose type it actually converts, the macro would rewrite nothing and be 'ineffective', so it emits this compile error to signal misuse.","triggerScenarios":"Applying the momo-based attribute macro to a function whose parameters use no supported conversion types (`&str`->`String`, `impl Into<...>` patterns it recognizes), so `has_conversion_in_effect` is false.","commonSituations":"Annotating a function with no arguments or only already-concrete types; adding the macro to a helper by copy-paste; removing a parameter that previously needed conversion without removing the attribute.","solutions":["Remove the attribute macro — it serves no purpose on a function with no convertible arguments.","Give the function parameters that the macro converts (e.g. `impl Into<String>` instead of `String`).","Check the macro's supported `Conversion` list in gix-macros/src/momo.rs to see which parameter types qualify."],"exampleFix":"// before: nothing to convert -> compile error\n#[momo]\nfn open(id: u64) -> Repo { ... }\n\n// after: remove the attribute, or make an argument convertible\nfn open(id: u64) -> Repo { ... }\n// or\n#[momo]\nfn open(path: impl Into<PathBuf>) -> Repo { ... }","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only apply momo-based attributes to functions with convertible parameters (e.g. `impl Into<...>`).","Remove the attribute when the function has no arguments needing conversion.","Check gix-macros/src/momo.rs `Conversion` enum for supported parameter types."],"tags":["proc-macro","compile-time","rust","gix-macros"],"backgroundTag":"invalid-argument-value","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}