Skip to content

Commit c157b3c

Browse files
krayc425bryce-b
andauthored
Use let instead of var for non-mutated variables (#845)
Co-authored-by: Bryce Buchanan <[email protected]>
1 parent ef63c34 commit c157b3c

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Sources/OpenTelemetryApi/Trace/Span.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public extension Span {
196196
/// - reasonPhrase: Http reason phrase.
197197
func putHttpStatusCode(statusCode: Int, reasonPhrase: String) {
198198
setAttribute(key: .httpStatusCode, value: statusCode)
199-
var newStatus: Status = switch statusCode {
199+
let newStatus: Status = switch statusCode {
200200
case 200 ..< 400:
201201
.ok
202202
case 400 ..< 600:

Sources/OpenTelemetryApi/Trace/TraceFlags.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public struct TraceFlags: Equatable, CustomStringConvertible, Codable {
7575
/// Sets the sampling bit in the options.
7676
/// - Parameter isSampled: the sampling bit
7777
public func settingIsSampled(_ isSampled: Bool) -> TraceFlags {
78-
var optionsCopy: UInt8 = if isSampled {
78+
let optionsCopy: UInt8 = if isSampled {
7979
options | TraceFlags.isSampled
8080
} else {
8181
options & ~TraceFlags.isSampled

Sources/OpenTelemetrySdk/Trace/SpanBuilderSdk.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class SpanBuilderSdk: SpanBuilder {
197197
private func getParentContext(parentType: ParentType, explicitParent: Span?, remoteParent: SpanContext?) -> SpanContext? {
198198
let currentSpan = OpenTelemetry.instance.contextProvider.activeSpan
199199

200-
var parentContext: SpanContext? = switch parentType {
200+
let parentContext: SpanContext? = switch parentType {
201201
case .noParent:
202202
nil
203203
case .currentSpan:

0 commit comments

Comments
 (0)