Skip to content

Commit

Permalink
fix(plugin): Modernize syntax usage
Browse files Browse the repository at this point in the history
  • Loading branch information
SkylerLipthay committed May 1, 2015
1 parent 8811585 commit 84c8a00
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions deuterium-plugin/src/model/generator.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use syntax::{ast, codemap};
use syntax::ext::base;
use syntax::util::small_vector;
use syntax::ext::quote::rt::ToSource;
use syntax::ext::build::AstBuilder;
use syntax::print::pprust;

use super::super::helpers;

Expand All @@ -19,7 +19,7 @@ impl super::super::Generator<()> for super::ModelState {

let mut ts_fields = vec![];
for field in model_struct_def.fields.iter() {
let field_ty = field.node.ty.to_source();
let field_ty = pprust::ty_to_string(&*field.node.ty);

// Name table field as model field
let (field_name, visibility) = match field.node.kind {
Expand Down
8 changes: 4 additions & 4 deletions deuterium-plugin/src/model/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ impl<'a, 'b> super::super::Parser<(codemap::Span, &'a mut base::ExtCtxt<'b>, Opt
let name = match name {
Some(name) => name,
None => {
parser.fatal("Name of the table must be present in model block")
panic!(parser.fatal("Name of the table must be present in model block"))
}
};

// Guards on struct
let maybe_model_struct = parser.parse_item_with_outer_attributes();
let maybe_model_struct = parser.parse_item();
let model_struct = match maybe_model_struct {
Some(model_struct) => {
match model_struct.node {
ast::ItemStruct(_, _) => model_struct,
_ => {
let span = parser.span;
parser.span_fatal(span, "Only struct can be presented in the body")
panic!(parser.span_fatal(span, "Only struct can be presented in the body"))
}
}
},
None => {
let span = parser.span;
parser.span_fatal(span, "Please provide model struct")
panic!(parser.span_fatal(span, "Please provide model struct"))
}
};

Expand Down

0 comments on commit 84c8a00

Please sign in to comment.