Skip to content

Commit

Permalink
fix formatting with rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
LoZack19 committed Aug 30, 2024
1 parent 247edfe commit 3dd3c23
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
target
*.bk
.idea
.vscode
1 change: 0 additions & 1 deletion scraper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ deterministic = ["indexmap"]
main = ["getopts"]
atomic = []
errors = []
macros = []

[[bin]]
name = "scraper"
Expand Down
13 changes: 8 additions & 5 deletions scraper_proc_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ use syn::{parse_macro_input, LitStr};
#[proc_macro]
pub fn selector(input: TokenStream) -> TokenStream {
let selector = parse_macro_input!(input as LitStr);

match scraper::Selector::parse(&selector.value()) {
Ok(_) => quote!(
::scraper::Selector::parse(#selector).unwrap()
).into(),
)
.into(),
Err(e) => syn::Error::new(
proc_macro2::Span::call_site(),
format!("Failed to parse CSS selector: {}", e)
).to_compile_error().into(),
format!("Failed to parse CSS selector: {}", e),
)
.to_compile_error()
.into(),
}
}
}

0 comments on commit 3dd3c23

Please sign in to comment.