File tree Expand file tree Collapse file tree 2 files changed +21
-15
lines changed Expand file tree Collapse file tree 2 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -7704,7 +7704,7 @@ mod tests {
7704
7704
);
7705
7705
minify_test(
7706
7706
".foo { border-width: clamp(1em, 2em, 4vh) }",
7707
- ".foo{border-width:min( 2em,4vh)}",
7707
+ ".foo{border-width:clamp(1em, 2em,4vh)}",
7708
7708
);
7709
7709
minify_test(
7710
7710
".foo { border-width: clamp(1em, 2vh, 4vh) }",
@@ -7715,6 +7715,10 @@ mod tests {
7715
7715
".foo{border-width:clamp(1px,1px + 2em,4px)}",
7716
7716
);
7717
7717
minify_test(".foo { border-width: clamp(1px, 2pt, 1in) }", ".foo{border-width:2pt}");
7718
+ minify_test(
7719
+ ".foo { width: clamp(-100px, 0px, 50% - 50vw); }",
7720
+ ".foo{width:clamp(-100px,0px,50% - 50vw)}",
7721
+ );
7718
7722
7719
7723
minify_test(
7720
7724
".foo { top: calc(-1 * clamp(1.75rem, 8vw, 4rem)) }",
Original file line number Diff line number Diff line change @@ -400,22 +400,24 @@ impl<
400
400
None => { }
401
401
}
402
402
403
- let cmp = if let ( Some ( Calc :: Value ( min_val) ) , Calc :: Value ( center_val) ) = ( & min, & center) {
404
- center_val. partial_cmp( & min_val)
405
- } else {
406
- None
407
- } ;
403
+ if cmp. is_some( ) {
404
+ let cmp = if let ( Some ( Calc :: Value ( min_val) ) , Calc :: Value ( center_val) ) = ( & min, & center) {
405
+ center_val. partial_cmp( & min_val)
406
+ } else {
407
+ None
408
+ } ;
408
409
409
- // If center is known to be less than the minimum, replace it with minimum and remove the min argument.
410
- // Otherwise, if center is known to be greater than the minimum, remove the min argument.
411
- match cmp {
412
- Some ( std:: cmp:: Ordering :: Less ) => {
413
- center = std:: mem:: take( & mut min) . unwrap( ) ;
414
- }
415
- Some ( _) => {
416
- min = None ;
410
+ // If center is known to be less than the minimum, replace it with minimum and remove the min argument.
411
+ // Otherwise, if center is known to be greater than the minimum, remove the min argument.
412
+ match cmp {
413
+ Some ( std:: cmp:: Ordering :: Less ) => {
414
+ center = std:: mem:: take( & mut min) . unwrap( ) ;
415
+ }
416
+ Some ( _) => {
417
+ min = None ;
418
+ }
419
+ None => { }
417
420
}
418
- None => { }
419
421
}
420
422
421
423
// Generate clamp(), min(), max(), or value depending on which arguments are left.
You can’t perform that action at this time.
0 commit comments