Skip to content

Commit bd5396a

Browse files
committed
Move icon helper.
1 parent 60c05e9 commit bd5396a

3 files changed

Lines changed: 11 additions & 16 deletions

File tree

libclide-macros/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,11 @@ use syn::{ItemStruct, parse_macro_input};
99
#[proc_macro_attribute]
1010
pub 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

libclide/src/fs.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,4 @@
44

55
pub 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;

libclide/src/fs/entry_meta.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
}

0 commit comments

Comments
 (0)