• Home
  • Raw
  • Download

Lines Matching +full:rustfmt +full:- +full:clippy

1 …hub]](https://github.com/dtolnay/syn) [![crates-io]](https://crates.io/crates/syn) [![do…
3 //! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo…
4 //! [crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&labelColor=55555…
5 //! [docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge&labelColor=555555&lo…
15 //! - **Data structures** — Syn provides a complete syntax tree that can
21 //! - **Derives** — Of particular interest to derive macros is
24 //! derive implementations of a user-defined trait.
26 //! - **Parsing** — Parsing in Syn is built around [parser functions] with the
27 //! signature `fn(ParseStream) -> Result<T>`. Every syntax tree node defined
32 //! - **Location information** — Every token parsed by Syn is associated with a
38 //! - **Feature flags** — Functionality is aggressively feature gated so your
69 //! proc-macro = true
82 //! pub fn my_macro(input: TokenStream) -> TokenStream {
86 //! // Build the output, possibly using quasi-quotation
105 //! fn heap_size_of_children(&self) -> usize;
128 //! The token-based procedural macro API provides great control over where the
143 //! procedural macro as shown in the `heapsize` example, token-based macros in
149 //! --> src/main.rs:7:5
159 //! The [`lazy-static`] example directory shows the implementation of a
163 //! [`lazy-static`]: https://github.com/dtolnay/syn/tree/master/examples/lazy-static
174 //! static ref USERNAME: Regex = Regex::new("^[a-z0-9_-]{3,16}$").unwrap();
183 //! --> src/main.rs:10:16
209 //! generated code looks like. Use `cargo rustc -- -Zunstable-options
210 //! --pretty=expanded` or the [`cargo expand`] subcommand.
212 //! [`cargo expand`]: https://github.com/dtolnay/cargo-expand
216 //! your own test cases, run `cargo expand --test the_test_case` where the last
219 //! This write-up by Brandon W Maister discusses debugging in more detail:
222 //! [debugging]: https://quodlibetor.github.io/posts/debugging-rusts-new-custom-derive-system/
232 //! - **`derive`** *(enabled by default)* — Data structures for representing the
234 //! - **`full`** — Data structures for representing the syntax tree of all valid
236 //! - **`parsing`** *(enabled by default)* — Ability to parse input tokens into
238 //! - **`printing`** *(enabled by default)* — Ability to print a syntax tree
240 //! - **`visit`** — Trait for traversing a syntax tree.
241 //! - **`visit-mut`** — Trait for traversing and mutating in place a syntax
243 //! - **`fold`** — Trait for transforming an owned syntax tree.
244 //! - **`clone-impls`** *(enabled by default)* — Clone impls for all syntax tree
246 //! - **`extra-traits`** — Debug, Eq, PartialEq, Hash impls for all syntax tree
248 //! - **`proc-macro`** *(enabled by default)* — Runtime dependency on the
257 clippy::bool_to_int_with_if,
258 clippy::cast_lossless,
259 clippy::cast_possible_truncation,
260 clippy::cast_possible_wrap,
261 clippy::cast_ptr_alignment,
262 clippy::default_trait_access,
263 clippy::derivable_impls,
264 clippy::diverging_sub_expression,
265 clippy::doc_markdown,
266 clippy::expl_impl_clone_on_copy,
267 clippy::explicit_auto_deref,
268 clippy::if_not_else,
269 clippy::inherent_to_string,
270 clippy::into_iter_without_iter,
271 clippy::items_after_statements,
272 clippy::large_enum_variant,
273 clippy::let_underscore_untyped, // https://github.com/rust-lang/rust-clippy/issues/10410
274 clippy::manual_assert,
275 clippy::manual_let_else,
276 clippy::match_like_matches_macro,
277 clippy::match_on_vec_items,
278 clippy::match_same_arms,
279clippy::match_wildcard_for_single_variants, // clippy bug: https://github.com/rust-lang/rust-clipp…
280 clippy::missing_errors_doc,
281 clippy::missing_panics_doc,
282 clippy::module_name_repetitions,
283 clippy::must_use_candidate,
284 clippy::needless_doctest_main,
285 clippy::needless_pass_by_value,
286 clippy::never_loop,
287 clippy::range_plus_one,
288 clippy::redundant_else,
289 clippy::return_self_not_must_use,
290 clippy::similar_names,
291 clippy::single_match_else,
292 clippy::too_many_arguments,
293 clippy::too_many_lines,
294 clippy::trivially_copy_pass_by_ref,
295 clippy::uninhabited_references,
296 clippy::uninlined_format_args,
297 clippy::unnecessary_box_returns,
298 clippy::unnecessary_unwrap,
299 clippy::used_underscore_binding,
300 clippy::wildcard_imports,
303 #[cfg(feature = "proc-macro")]
448 #[cfg(all(feature = "parsing", feature = "proc-macro"))]
505 #[cfg(all(any(feature = "full", feature = "derive"), feature = "extra-traits"))]
540 /// fn fold_expr_binary(&mut self, node: ExprBinary) -> ExprBinary {
545 /// # fn fold_attribute(&mut self, node: Attribute) -> Attribute;
546 /// # fn fold_expr(&mut self, node: Expr) -> Expr;
547 /// # fn fold_bin_op(&mut self, node: BinOp) -> BinOp;
550 /// pub fn fold_expr_binary<V>(v: &mut V, node: ExprBinary) -> ExprBinary
587 /// fn fold_expr(&mut self, expr: Expr) -> Expr {
607 #[rustfmt::skip]
726 #[rustfmt::skip]
780 /// // syn = { version = "2.0", features = ["full", "visit-mut"] }
818 #[cfg(feature = "visit-mut")]
819 #[cfg_attr(doc_cfg, doc(cfg(feature = "visit-mut")))]
820 #[rustfmt::skip]
823 #[cfg(feature = "clone-impls")]
824 #[rustfmt::skip]
827 #[cfg(feature = "extra-traits")]
828 #[rustfmt::skip]
831 #[cfg(feature = "extra-traits")]
832 #[rustfmt::skip]
835 #[cfg(feature = "extra-traits")]
836 #[rustfmt::skip]
852 #[cfg(feature = "visit-mut")]
853 #[cfg_attr(doc_cfg, doc(cfg(feature = "visit-mut")))]
886 /// pub fn my_macro(input: TokenStream) -> TokenStream {
890 /// // Build the output, possibly using quasi-quotation
899 #[cfg(all(feature = "parsing", feature = "proc-macro"))]
900 #[cfg_attr(doc_cfg, doc(cfg(all(feature = "parsing", feature = "proc-macro"))))]
901 pub fn parse<T: parse::Parse>(tokens: proc_macro::TokenStream) -> Result<T> { in parse()
905 /// Parse a proc-macro2 token stream into the chosen syntax tree node.
919 pub fn parse2<T: parse::Parse>(tokens: proc_macro2::TokenStream) -> Result<T> { in parse2()
935 /// fn run() -> Result<()> {
946 pub fn parse_str<T: parse::Parse>(s: &str) -> Result<T> { in parse_str()
956 /// - It discards a leading byte order mark `\u{FEFF}` if the file has one.
957 /// - It preserves the shebang line of the file, such as `#!/usr/bin/env rustx`.
968 /// fn run() -> Result<(), Box<dyn Error>> {
986 pub fn parse_file(mut content: &str) -> Result<File> { in parse_file()