Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Correct whitespace
Browse files Browse the repository at this point in the history
@tomusdrw please note the alterations - no mixing tabs and spaces in the indentation portion and always just one tab per indent.
  • Loading branch information
gavofyork authored Oct 15, 2016
1 parent f6d279f commit 7c23bb2
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions dapps/js-glue/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,19 @@ pub fn expand_webapp_implementation(
meta_item: &MetaItem,
annotatable: &Annotatable,
push: &mut FnMut(Annotatable)
) {
let item = match *annotatable {
Annotatable::Item(ref item) => item,
_ => {
cx.span_err(meta_item.span, "`#[derive(WebAppFiles)]` may only be applied to struct implementations");
return;
},
};

let builder = aster::AstBuilder::new().span(span);

implement_webapp(cx, &builder, &item, push);
}
) {
let item = match *annotatable {
Annotatable::Item(ref item) => item,
_ => {
cx.span_err(meta_item.span, "`#[derive(WebAppFiles)]` may only be applied to struct implementations");
return;
},
};
let builder = aster::AstBuilder::new().span(span);
implement_webapp(cx, &builder, &item, push);
}

fn implement_webapp(cx: &ExtCtxt, builder: &aster::AstBuilder, item: &Item, push: &mut FnMut(Annotatable)) {

let static_files_dir = extract_path(cx, item);

let src = Path::new("src");
Expand Down Expand Up @@ -94,25 +91,27 @@ fn implement_webapp(cx: &ExtCtxt, builder: &aster::AstBuilder, item: &Item, push
let env_id = builder.id("env!");
let macro_id = builder.id("include_bytes!");

let content = quote_expr!(cx,
$macro_id($concat_id($env_id("CARGO_MANIFEST_DIR"), $separator_lit, $web_path_lit))
);
quote_stmt!(cx,
files.insert($path_lit, File { path: $path_lit, content_type: $mime_lit, content: $content });
).expect("The statement is always ok, because it just uses literals.")
let content = quote_expr!(
cx,
$macro_id($concat_id($env_id("CARGO_MANIFEST_DIR"), $separator_lit, $web_path_lit))
);
quote_stmt!(
cx,
files.insert($path_lit, File { path: $path_lit, content_type: $mime_lit, content: $content });
).expect("The statement is always ok, because it just uses literals.")
}).collect::<Vec<ast::Stmt>>();

let type_name = item.ident;

let files_impl = quote_item!(cx,
impl $type_name {
fn files() -> ::std::collections::HashMap<&'static str, File> {
let mut files = ::std::collections::HashMap::new();
$statements
files
}
}
).unwrap();
impl $type_name {
fn files() -> ::std::collections::HashMap<&'static str, File> {
let mut files = ::std::collections::HashMap::new();
$statements
files
}
}
).unwrap();

push(Annotatable::Item(files_impl));
}
Expand Down Expand Up @@ -142,9 +141,10 @@ fn get_str_from_lit(cx: &ExtCtxt, name: &str, lit: &ast::Lit) -> Option<Interned
cx.span_err(
lit.span,
&format!("webapp annotation `{}` must be a string, not `{}`",
name,
lit_to_string(lit)));

name,
lit_to_string(lit)
)
);
return None;
}
}
Expand Down

1 comment on commit 7c23bb2

@tomusdrw
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that! I haven't noticed those.
It's mostly copy pasted code from old parity-dapps library that I've developed without proper .editorconfig.

Please sign in to comment.