File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,15 +9,11 @@ use syn::{ItemStruct, parse_macro_input};
99#[ proc_macro_attribute]
1010pub fn log_id ( _attr : TokenStream , item : TokenStream ) -> TokenStream {
1111 let input = parse_macro_input ! ( item as ItemStruct ) ;
12-
1312 let struct_name = & input. ident ;
1413 let generics = & input. generics ;
1514
16- // This is the important part
1715 let ( impl_generics, type_generics, where_clause) = generics. split_for_impl ( ) ;
18-
1916 let struct_name_str = struct_name. to_string ( ) ;
20-
2117 let expanded = quote ! {
2218 #input
2319
Original file line number Diff line number Diff line change 44
55pub mod entry_meta;
66
7- use devicons:: FileIcon ;
8- use std:: path:: Path ;
9-
10- pub fn icon < P : AsRef < str > > ( p : P ) -> FileIcon {
11- let path = p. as_ref ( ) ;
12- if Path :: new ( & path) . is_dir ( ) {
13- // Ensures directories are given a folder icon and not mistakenly resolved to a language.
14- // For example, a directory named `cpp` would otherwise return a C++ icon.
15- return FileIcon :: from ( "dir/" ) ;
16- }
17- FileIcon :: from ( path)
18- }
7+ pub use entry_meta:: icon;
Original file line number Diff line number Diff line change @@ -52,3 +52,13 @@ impl EntryMeta {
5252 } )
5353 }
5454}
55+
56+ pub fn icon < P : AsRef < str > > ( p : P ) -> FileIcon {
57+ let path = p. as_ref ( ) ;
58+ if Path :: new ( & path) . is_dir ( ) {
59+ // Ensures directories are given a folder icon and not mistakenly resolved to a language.
60+ // For example, a directory named `cpp` would otherwise return a C++ icon.
61+ return FileIcon :: from ( "dir/" ) ;
62+ }
63+ FileIcon :: from ( path)
64+ }
You can’t perform that action at this time.
0 commit comments