-
Notifications
You must be signed in to change notification settings - Fork 6
Conversation
|
||
impl Dependency { | ||
pub fn parse(b: &ftd::p2::Document) -> Vec<Dependency> { | ||
b.to_owned().instances("fpm#dependency").unwrap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets return Result instead of panicking.
src/dependency.rs
Outdated
k => k.to_string(), | ||
}; | ||
|
||
let response = reqwest::get(download_url).await.expect(""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove .expect()
and use .await?
.
|
||
let response = reqwest::get(download_url).await.expect(""); | ||
|
||
std::fs::create_dir_all("./.packages/.cache").expect("failed to create build folder"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this expect also.
src/dependency.rs
Outdated
let download_path = format!("./.packages/.cache/{}.zip", self.name.replace("/", "__")); | ||
let path = std::path::Path::new(download_path.as_str()); | ||
let mut file = match std::fs::File::create(&path) { | ||
Err(why) => panic!("couldn't create {}", why), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return Err()
.
clap = "2.33.3" | ||
home = "0.5.3" | ||
reqwest = { version = "0.11.6"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should create a lint or auto formatter that converts such lines into reqwest = "0.11.6"
.
unreachable!("must never happen") | ||
} | ||
|
||
#[derive(thiserror::Error, Debug, serde_derive::Deserialize)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we deriving Deserialise
?
#[error("{doc_id}:{line_number} -> {message}")] | ||
ParseError { | ||
message: String, | ||
doc_id: String, | ||
line_number: usize, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we get this error? Technically we are parsing things, and there can be errors. But largely most errors would come from ftd
.
* ignored grepping id for commented/escaped-out components * ignored ids under component definition * clippy fix + removed debugs * id regex adjustment * adjusted to ignore mapping ids for youtube components + refactored code * removed debugs + minor adjustments * adjustments for few more cases * using moved ftd parsing functions #1 * using moved ftd parsing functions #2 * moved ID regex to ftd and removed debugs * cargo fmt * bumped ftd version -> 7c702f9
No description provided.