Pārlūkot izejas kodu

Code improvement
Removed unused or duplicated code

Goldy 8 gadi atpakaļ
vecāks
revīzija
6dd497bbc8

+ 1 - 1
src/Avalonia.Controls/Calendar/Calendar.cs

@@ -549,7 +549,7 @@ namespace Avalonia.Controls
                         }
                         else
                         {
-                            if (addedDate.HasValue && !(SelectedDates.Count > 0 && SelectedDates[0] == addedDate.Value))
+                            if (!(SelectedDates.Count > 0 && SelectedDates[0] == addedDate.Value))
                             {
                                 foreach (DateTime item in SelectedDates)
                                 {

+ 0 - 1
src/Avalonia.Controls/Control.cs

@@ -621,7 +621,6 @@ namespace Avalonia.Controls
             Contract.Requires<ArgumentNullException>(property != null);
             Contract.Requires<ArgumentNullException>(selector != null);
             Contract.Requires<ArgumentNullException>(className != null);
-            Contract.Requires<ArgumentNullException>(property != null);
 
             if (string.IsNullOrWhiteSpace(className))
             {

+ 1 - 1
src/Avalonia.Controls/Primitives/SelectingItemsControl.cs

@@ -297,7 +297,7 @@ namespace Avalonia.Controls.Primitives
                 .OfType<IControl>()
                 .FirstOrDefault(x => x.LogicalParent == this && ItemContainerGenerator?.IndexFromContainer(x) != -1);
 
-            return item as IControl;
+            return item;
         }
 
         /// <inheritdoc/>

+ 1 - 4
src/Avalonia.Controls/TreeView.cs

@@ -176,10 +176,7 @@ namespace Avalonia.Controls
 
                 SelectedItem = item;
 
-                if (SelectedItem != null)
-                {
-                    MarkContainerSelected(container, true);
-                }
+                MarkContainerSelected(container, true);
             }
         }
 

+ 1 - 1
src/Avalonia.Visuals/Media/PathMarkupParser.cs

@@ -320,7 +320,7 @@ namespace Avalonia.Media
                     if (c == 'E')
                     {
                         readSign = false;
-                        readExponent = c == 'E';
+                        readExponent = true;
                     }
                 }
                 else

+ 1 - 1
src/Avalonia.Visuals/Rendering/SceneGraph/SceneBuilder.cs

@@ -192,7 +192,7 @@ namespace Avalonia.Rendering.SceneGraph
                             UpdateLayer(node, scene.Layers[node.LayerRoot]);
                         }
                     }
-                    else if (!startLayer && node.LayerRoot == node.Visual && node.Parent != null)
+                    else if (node.LayerRoot == node.Visual && node.Parent != null)
                     {
                         ClearLayer(scene, node);
                     }

+ 1 - 9
src/Markup/Avalonia.Markup/Data/Parsers/ArgumentListParser.cs

@@ -51,15 +51,7 @@ namespace Avalonia.Markup.Data.Parsers
                     }
                 }
 
-                if (!r.End)
-                {
-                    r.Take();
-                    return result;
-                }
-                else
-                {
-                    throw new ExpressionParseException(r.Position, "Expected ']'.");
-                }
+                throw new ExpressionParseException(r.Position, "Expected ']'.");
             }
 
             return null;

+ 0 - 1
src/Windows/Avalonia.Direct2D1/Media/DrawingContextImpl.cs

@@ -54,7 +54,6 @@ namespace Avalonia.Direct2D1.Media
             _finishedCallback = finishedCallback;
             _directWriteFactory = directWriteFactory;
             _imagingFactory = imagingFactory;
-            _swapChain = swapChain;
             _renderTarget.BeginDraw();
         }