mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 23:08:05 +08:00
Improve type handling for ints/floats with the #[hard/soft_min/max(...)] node macro parameter attributes (#4041)
This commit is contained in:
@@ -34,8 +34,8 @@ fn validate_min_max(parsed: &ParsedNodeFn) {
|
||||
} = field
|
||||
{
|
||||
if let (Some(soft_min), Some(hard_min)) = (number_soft_min, number_hard_min) {
|
||||
let soft_min_value: f64 = soft_min.base10_parse().unwrap_or_default();
|
||||
let hard_min_value: f64 = hard_min.base10_parse().unwrap_or_default();
|
||||
let soft_min_value: f64 = soft_min.to_f64();
|
||||
let hard_min_value: f64 = hard_min.to_f64();
|
||||
if soft_min_value == hard_min_value {
|
||||
emit_error!(
|
||||
pat_ident.span(),
|
||||
@@ -56,8 +56,8 @@ fn validate_min_max(parsed: &ParsedNodeFn) {
|
||||
}
|
||||
|
||||
if let (Some(soft_max), Some(hard_max)) = (number_soft_max, number_hard_max) {
|
||||
let soft_max_value: f64 = soft_max.base10_parse().unwrap_or_default();
|
||||
let hard_max_value: f64 = hard_max.base10_parse().unwrap_or_default();
|
||||
let soft_max_value: f64 = soft_max.to_f64();
|
||||
let hard_max_value: f64 = hard_max.to_f64();
|
||||
if soft_max_value == hard_max_value {
|
||||
emit_error!(
|
||||
pat_ident.span(),
|
||||
|
||||
Reference in New Issue
Block a user