fix: fix some format! macro issues in workspace.rs

merge-requests/12/head
Nefo Fortressia 2021-11-11 07:30:25 +07:00
parent 966a909ab8
commit cc6d331670
Signed by: fortressia
GPG Key ID: 6D7972CC76174995
1 changed files with 6 additions and 12 deletions

View File

@ -95,28 +95,22 @@ impl WorkspaceImplementedEditor for EchidnaWindow {
let filepath = Path::new(&filepath_raw); let filepath = Path::new(&filepath_raw);
let info = file let info = file
.query_info("*", gio::FileQueryInfoFlags::NONE, Some(&cancellable)) .query_info("*", gio::FileQueryInfoFlags::NONE, Some(&cancellable))
.expect(format!( .expect(format!("Could not retrieve file information for {:?}", filepath).as_str());
"Could not retrieve file information for {:?}",
filepath
));
let content_type = info let content_type = info
.content_type() .content_type()
.expect(format!("Found no content type for {:?}", filepath)); .expect(format!("Found no content type for {:?}", filepath).as_str());
println!( println!(
"Opened {} and found its content type is {}.", "Opened {} and found its content type is {}.",
"file", "file",
content_type.to_string() content_type.to_string()
); );
let content_cancellable = Cancellable::new(); let content_cancellable = Cancellable::new();
let content = file let (content, _) = file
.load_contents(Some(&content_cancellable)) .load_contents(Some(&content_cancellable))
.expect("Could not load the file contents for {:?}", filepath); .expect(format!("Could not load the file contents for {:?}", filepath).as_str());
let (int_vec, _byte_string) = content; let workspace = serde_json::from_slice::<MonacoWorkspace>(&content)
let workspace = serde_json::from_slice::<MonacoWorkspace>(&int_vec).expect(format!( .expect(format!("Could not parse the workspace file of {:?}", filepath).as_str());
"Could not parse the workspace file of {:?}",
filepath
));
for folder in workspace.folders { for folder in workspace.folders {
let path = RelativePath::new(&folder.path); let path = RelativePath::new(&folder.path);