diff --git a/AltCover.Engine/ProgramDatabase.fs b/AltCover.Engine/ProgramDatabase.fs index 5b324fae..a2f1b828 100644 --- a/AltCover.Engine/ProgramDatabase.fs +++ b/AltCover.Engine/ProgramDatabase.fs @@ -272,8 +272,7 @@ module internal ProgramDatabase = let folder = foldername :: (Seq.toList symbolFolders) - |> Seq.map (I.getSymbolsByFolder filename) - |> Seq.choose id + |> Seq.choose (I.getSymbolsByFolder filename) |> Seq.tryFind (I.symbolMatch tokens) sprintf diff --git a/AltCover.Engine/Visitor.fs b/AltCover.Engine/Visitor.fs index ce689168..88034f77 100644 --- a/AltCover.Engine/Visitor.fs +++ b/AltCover.Engine/Visitor.fs @@ -820,7 +820,7 @@ module internal Visitor = + name CoverageParameters.trackingNames - |> Seq.map (fun n -> + |> Seq.choose (fun n -> if n.Chars(0) = '[' then let stripped = n.Trim([| '['; ']' |]) @@ -844,7 +844,6 @@ module internal Visitor = Some n else None) - |> Seq.choose id |> Seq.tryFind (fun _ -> true) |> Option.map (fun n -> let id = methodNumber + 1 @@ -1649,18 +1648,18 @@ module internal Visitor = "AvoidMessageChainsRule", Scope = "member", Target = - "AltCover.Visitor/I/generated@1380::Invoke(Mono.Cecil.Cil.Instruction)", + "AltCover.Visitor/I/generated@1379::Invoke(Mono.Cecil.Cil.Instruction)", Justification = "No direct call available")>] [,Microsoft.FSharp.Collections.FSharpList`1)", + "AltCover.Visitor/I/start@1229::Invoke(Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Collections.FSharpList`1)", Justification = "Inlined library code")>] [,Microsoft.FSharp.Collections.FSharpList`1)", + "AltCover.Visitor/I/finish@1232::Invoke(Microsoft.FSharp.Core.FSharpFunc`2,Microsoft.FSharp.Collections.FSharpList`1)", Justification = "Inlined library code")>] () \ No newline at end of file diff --git a/AltCover.Tests/Tests.fs b/AltCover.Tests/Tests.fs index 5631b715..c4148d12 100644 --- a/AltCover.Tests/Tests.fs +++ b/AltCover.Tests/Tests.fs @@ -1845,8 +1845,7 @@ module AltCoverTests = Assert.That( methods - |> Seq.map Visitor.I.containingMethod - |> Seq.choose id + |> Seq.choose Visitor.I.containingMethod |> Seq.filter (fun m -> m.Name = "G3"), Is.EquivalentTo [ g3; g3; g3 ] ) @@ -1855,8 +1854,7 @@ module AltCoverTests = Assert.That( methods - |> Seq.map Visitor.I.containingMethod - |> Seq.choose id + |> Seq.choose Visitor.I.containingMethod |> Seq.filter (fun m -> m.Name = "G1"), Is.EquivalentTo [ g1; g1 ] ) @@ -2970,8 +2968,7 @@ module AltCoverTests = let tracks = def.MainModule.GetAllTypes() |> Seq.collect (fun t -> t.Methods) - |> Seq.map (Visitor.I.track) - |> Seq.choose id + |> Seq.choose (Visitor.I.track) |> Seq.toList Assert.That(tracks, Is.EquivalentTo [ (1, "[Test"); (2, "[Test") ]) @@ -3029,8 +3026,7 @@ module AltCoverTests = let tracks = def.MainModule.GetAllTypes() |> Seq.collect (fun t -> t.Methods) - |> Seq.map (Visitor.I.track) - |> Seq.choose id + |> Seq.choose (Visitor.I.track) |> Seq.toList Assert.That( @@ -3069,8 +3065,7 @@ module AltCoverTests = let tracks = def.MainModule.GetAllTypes() |> Seq.collect (fun t -> t.Methods) - |> Seq.map (Visitor.I.track) - |> Seq.choose id + |> Seq.choose (Visitor.I.track) |> Seq.toList Assert.That( @@ -4661,11 +4656,10 @@ module AltCoverTests = Inspection = Inspections.Instrument Track = None DefaultVisitCount = Exemption.None } - |> Seq.map (fun n -> + |> Seq.choose (fun n -> match n with | BranchPoint b -> Some b | _ -> None) - |> Seq.choose id |> Seq.toList // The only overt branching in this function are the 4 match cases // Internal IL conditional branching is a compiler thing from inlining "string" diff --git a/AltCover.Tests/Tests2.fs b/AltCover.Tests/Tests2.fs index 61ec91f2..58168413 100644 --- a/AltCover.Tests/Tests2.fs +++ b/AltCover.Tests/Tests2.fs @@ -2109,11 +2109,10 @@ has been prefixed with Ldc_I4_1 (1 byte) Inspection = Inspections.Instrument Track = None DefaultVisitCount = Exemption.None } - |> Seq.map (fun n -> + |> Seq.choose (fun n -> match n with | BranchPoint b -> Some b | _ -> None) - |> Seq.choose id |> Seq.take 2 // start of a switch |> Seq.toList @@ -2207,11 +2206,10 @@ has been prefixed with Ldc_I4_1 (1 byte) Inspection = Inspections.Instrument Track = None DefaultVisitCount = Exemption.None } - |> Seq.map (fun n -> + |> Seq.choose (fun n -> match n with | BranchPoint b -> Some b | _ -> None) - |> Seq.choose id |> Seq.skip 2 |> Seq.take 2 // first of "switch" |> Seq.toList @@ -2298,11 +2296,10 @@ has been prefixed with Ldc_I4_1 (1 byte) Inspection = Inspections.Instrument Track = None DefaultVisitCount = Exemption.None } - |> Seq.map (fun n -> + |> Seq.choose (fun n -> match n with | BranchPoint b -> Some b | _ -> None) - |> Seq.choose id |> Seq.take 2 // start of a switch |> Seq.toList diff --git a/Demo/inspector/Program.fs b/Demo/inspector/Program.fs index 09959500..85650bc4 100644 --- a/Demo/inspector/Program.fs +++ b/Demo/inspector/Program.fs @@ -91,10 +91,8 @@ let inspect (def: AssemblyDefinition) = [] let main argv = argv - |> Seq.map getFileExists - |> Seq.choose id - |> Seq.map loadInCecil - |> Seq.choose id + |> Seq.choose getFileExists + |> Seq.choose loadInCecil |> Seq.iter inspect 0 // return an integer exit code \ No newline at end of file