mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-25 08:15:44 +00:00
sp-npos-elections should not depend on itself (#6444)
This removes the `dev-dependency` onto `sp-npos-elections` from itself. A crate should not depend on itself directly, especially not to make any macros work.
This commit is contained in:
@@ -18,8 +18,8 @@
|
||||
//! Code generation for the ratio assignment type.
|
||||
|
||||
use crate::field_name_for;
|
||||
use proc_macro2::{TokenStream as TokenStream2};
|
||||
use syn::{GenericArgument};
|
||||
use proc_macro2::TokenStream as TokenStream2;
|
||||
use syn::GenericArgument;
|
||||
use quote::quote;
|
||||
|
||||
fn from_impl(count: usize) -> TokenStream2 {
|
||||
|
||||
@@ -224,17 +224,19 @@ fn struct_def(
|
||||
}
|
||||
|
||||
fn imports() -> Result<TokenStream2> {
|
||||
let sp_phragmen_imports = match crate_name("sp-npos-elections") {
|
||||
Ok(sp_npos_elections) => {
|
||||
let ident = syn::Ident::new(&sp_npos_elections, Span::call_site());
|
||||
quote!( extern crate #ident as _phragmen; )
|
||||
if std::env::var("CARGO_PKG_NAME").unwrap() == "sp-npos-elections" {
|
||||
Ok(quote! {
|
||||
use crate as _phragmen;
|
||||
})
|
||||
} else {
|
||||
match crate_name("sp-npos-elections") {
|
||||
Ok(sp_npos_elections) => {
|
||||
let ident = syn::Ident::new(&sp_npos_elections, Span::call_site());
|
||||
Ok(quote!( extern crate #ident as _phragmen; ))
|
||||
},
|
||||
Err(e) => Err(syn::Error::new(Span::call_site(), &e)),
|
||||
}
|
||||
Err(e) => return Err(syn::Error::new(Span::call_site(), &e)),
|
||||
};
|
||||
|
||||
Ok(quote!(
|
||||
#sp_phragmen_imports
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
struct CompactSolutionDef {
|
||||
|
||||
Reference in New Issue
Block a user