@@ -417,49 +417,45 @@ defmodule Version do
417417 defp to_condition ( [ :'>' , version | _ ] ) do
418418 { major , minor , patch , pre } = parse_condition ( version )
419419
420- { :andalso , { :not , { :is_binary , :'$1' } } ,
421- { :orelse , { :'>' , { { :'$1' , :'$2' , :'$3' } } ,
422- { :const , { major , minor , patch } } } ,
423- { :andalso , { :'==' , { { :'$1' , :'$2' , :'$3' } } ,
424- { :const , { major , minor , patch } } } ,
425- { :orelse , { :andalso , { :'==' , { :length , :'$4' } , 0 } ,
426- { :'/=' , length ( pre ) , 0 } } ,
427- { :andalso , { :'/=' , length ( pre ) , 0 } ,
428- { :orelse , { :'>' , { :length , :'$4' } , length ( pre ) } ,
429- { :andalso , { :'==' , { :length , :'$4' } , length ( pre ) } ,
430- { :'>' , :'$4' , { :const , pre } } } } } } } } }
420+ { :orelse , { :'>' , { { :'$1' , :'$2' , :'$3' } } ,
421+ { :const , { major , minor , patch } } } ,
422+ { :andalso , { :'==' , { { :'$1' , :'$2' , :'$3' } } ,
423+ { :const , { major , minor , patch } } } ,
424+ { :orelse , { :andalso , { :'==' , { :length , :'$4' } , 0 } ,
425+ { :'/=' , length ( pre ) , 0 } } ,
426+ { :andalso , { :'/=' , length ( pre ) , 0 } ,
427+ { :orelse , { :'>' , { :length , :'$4' } , length ( pre ) } ,
428+ { :andalso , { :'==' , { :length , :'$4' } , length ( pre ) } ,
429+ { :'>' , :'$4' , { :const , pre } } } } } } } }
431430 end
432431
433432 defp to_condition ( [ :'>=' , version | _ ] ) do
434433 matchable = parse_condition ( version )
435434
436- { :orelse , { :andalso , { :not , { :is_binary , :'$1' } } ,
437- { :'==' , :'$_' , { :const , matchable } } } ,
438- to_condition ( [ :'>' , version ] ) }
435+ { :orelse , { :'==' , :'$_' , { :const , matchable } } ,
436+ to_condition ( [ :'>' , version ] ) }
439437 end
440438
441439 defp to_condition ( [ :'<' , version | _ ] ) do
442440 { major , minor , patch , pre } = parse_condition ( version )
443441
444- { :andalso , { :not , { :is_binary , :'$1' } } ,
445- { :orelse , { :'<' , { { :'$1' , :'$2' , :'$3' } } ,
446- { :const , { major , minor , patch } } } ,
447- { :andalso , { :'==' , { { :'$1' , :'$2' , :'$3' } } ,
448- { :const , { major , minor , patch } } } ,
449- { :orelse , { :andalso , { :'/=' , { :length , :'$4' } , 0 } ,
450- { :'==' , length ( pre ) , 0 } } ,
451- { :andalso , { :'/=' , { :length , :'$4' } , 0 } ,
452- { :orelse , { :'<' , { :length , :'$4' } , length ( pre ) } ,
453- { :andalso , { :'==' , { :length , :'$4' } , length ( pre ) } ,
454- { :'<' , :'$4' , { :const , pre } } } } } } } } }
442+ { :orelse , { :'<' , { { :'$1' , :'$2' , :'$3' } } ,
443+ { :const , { major , minor , patch } } } ,
444+ { :andalso , { :'==' , { { :'$1' , :'$2' , :'$3' } } ,
445+ { :const , { major , minor , patch } } } ,
446+ { :orelse , { :andalso , { :'/=' , { :length , :'$4' } , 0 } ,
447+ { :'==' , length ( pre ) , 0 } } ,
448+ { :andalso , { :'/=' , { :length , :'$4' } , 0 } ,
449+ { :orelse , { :'<' , { :length , :'$4' } , length ( pre ) } ,
450+ { :andalso , { :'==' , { :length , :'$4' } , length ( pre ) } ,
451+ { :'<' , :'$4' , { :const , pre } } } } } } } }
455452 end
456453
457454 defp to_condition ( [ :'<=' , version | _ ] ) do
458455 matchable = parse_condition ( version )
459456
460- { :orelse , { :andalso , { :not , { :is_binary , :'$1' } } ,
461- { :'==' , :'$_' , { :const , matchable } } } ,
462- to_condition ( [ :'<' , version ] ) }
457+ { :orelse , { :'==' , :'$_' , { :const , matchable } } ,
458+ to_condition ( [ :'<' , version ] ) }
463459 end
464460
465461 defp to_condition ( current , [ ] ) do
491487
492488defimpl String.Chars , for: Version do
493489 def to_string ( version ) do
494- pre = if pre = version . pre , do: "-#{ pre } "
490+ pre = unless Enum . empty? ( pre = version . pre ) , do: "-#{ pre } "
495491 build = if build = version . build , do: "+#{ build } "
496492 "#{ version . major } .#{ version . minor } .#{ version . patch } #{ pre } #{ build } "
497493 end
0 commit comments