sample.rs 492 B

1234567891011121314151617181920212223
  1. const SRC: &str = include_str!("./samples/all.rs");
  2. fn body() -> &'static str {
  3. &SRC[6..SRC.len() - 3]
  4. }
  5. fn unindented_body() -> String {
  6. body()
  7. .lines()
  8. .map(|line| match line.strip_prefix(" ") {
  9. Some(line) => line,
  10. None => line,
  11. })
  12. .collect::<Vec<_>>()
  13. .join("\n")
  14. }
  15. #[test]
  16. fn way_and_back() {
  17. let blocks = dioxus_autofmt::fmt_file(SRC).into_iter().next().unwrap();
  18. println!("{}", blocks.formatted);
  19. }