Skip to content

Commit

Permalink
Simplyfied required imports
Browse files Browse the repository at this point in the history
  • Loading branch information
kellerkindt committed May 4, 2020
1 parent ff375d4 commit 545fd57
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 1 addition & 3 deletions asn1rs-model/src/gen/rust/walker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,7 @@ impl AsnDefWalker {
}

impl GeneratorSupplement<Rust> for AsnDefWalker {
fn add_imports(&self, scope: &mut Scope) {
scope.raw("use asn1rs::prelude::*;");
}
fn add_imports(&self, _scope: &mut Scope) {}

fn impl_supplement(&self, scope: &mut Scope, definition: &Definition<Rust>) {
self.write_type_definitions(scope, definition);
Expand Down
7 changes: 7 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ extern crate postgres;
#[cfg(feature = "macros")]
pub extern crate asn1rs_macros as macros;

// provide an empty module, so that `use asn1rs::macros::*;` does not fail
#[cfg(not(feature = "macros"))]
pub mod macros {}

#[cfg(feature = "model")]
pub mod converter;
#[cfg(feature = "model")]
Expand All @@ -20,5 +24,8 @@ pub mod io;
pub mod syn;

pub mod prelude {
#[cfg(feature = "macros")]
pub use crate::macros::*;
pub use crate::syn::io::*;
pub use crate::syn::*;
}
8 changes: 2 additions & 6 deletions tests/basic_proc_macro_attribute.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#![allow(unused)]

use asn1rs::syn::io::{PrintlnWriter, UperReader, UperWriter};
use asn1rs::syn::Reader;
use asn1rs_macros::asn;
use asn1rs::prelude::*;

#[asn(sequence)]
#[derive(Debug, Default, PartialOrd, PartialEq)]
Expand All @@ -19,7 +15,7 @@ pub struct Potato {

#[test]
fn test_compiles() {
let p = Potato {
let _p = Potato {
size: 123,
size2: 1234,
size3: 234,
Expand Down

0 comments on commit 545fd57

Please sign in to comment.