Browse Source

fixes: Replace CS8600 warning suppression with null-forgiving operator

pull/6754/head
Giuseppe Lippolis 5 years ago
parent
commit
0309dda390
  1. 4
      src/Avalonia.Base/Data/BindingValue.cs
  2. 12
      src/Avalonia.Styling/Styling/Setter.cs

4
src/Avalonia.Base/Data/BindingValue.cs

@ -247,9 +247,7 @@ namespace Avalonia.Data
UnsetValueType _ => Unset,
DoNothingType _ => DoNothing,
BindingNotification n => n.ToBindingValue().Cast<T>(),
#pragma warning disable CS8600 // Converting null literal or possible null value to non-nullable type.
_ => new BindingValue<T>((T)value)
#pragma warning restore CS8600 // Converting null literal or possible null value to non-nullable type.
_ => new BindingValue<T>((T)value!)
};
}

12
src/Avalonia.Styling/Styling/Setter.cs

@ -101,11 +101,7 @@ namespace Avalonia.Styling
data.result = new PropertySetterInstance<T>(
data.target,
property,
#pragma warning disable CS8600 // Converting null literal or possible null value to non-nullable type.
#pragma warning disable CS8604 // Possible null reference argument.
(T)data.value);
#pragma warning restore CS8604 // Possible null reference argument.
#pragma warning restore CS8600 // Converting null literal or possible null value to non-nullable type.
(T)data.value!);
}
}
@ -132,11 +128,7 @@ namespace Avalonia.Styling
data.result = new PropertySetterInstance<T>(
data.target,
property,
#pragma warning disable CS8600 // Converting null literal or possible null value to non-nullable type.
#pragma warning disable CS8604 // Possible null reference argument.
(T)data.value);
#pragma warning restore CS8604 // Possible null reference argument.
#pragma warning restore CS8600 // Converting null literal or possible null value to non-nullable type.
(T)data.value!);
}
}

Loading…
Cancel
Save