Skip to content

Commit 1325a28

Browse files
committed
Merge pull request #2923 from tanadeau/remove-warn_unused_result-usage
2 parents d1e78f5 + b9db36c commit 1325a28

File tree

11 files changed

+36
-152
lines changed

11 files changed

+36
-152
lines changed

lib/Sema/TypeChecker.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,8 +1831,7 @@ class TypeChecker final : public LazyResolver {
18311831
/// Checks an "ignored" expression to see if it's okay for it to be ignored.
18321832
///
18331833
/// An ignored expression is one that is not nested within a larger
1834-
/// expression or statement. The warning from the \@warn_unused_result
1835-
/// attribute is produced here.
1834+
/// expression or statement.
18361835
void checkIgnoredExpr(Expr *E);
18371836

18381837
// Emits a diagnostic, if necessary, for a reference to a declaration

stdlib/public/core/CollectionAlgorithms.swift.gyb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ extension ${Self} where Self.Iterator.Element : Comparable {
322322
/// - Returns: A sorted array of the ${sequenceKind}'s elements.
323323
///
324324
/// - SeeAlso: `sorted(isOrderedBefore:)`
325-
@warn_unused_result(${'mutable_variant: "sort"' if Self == 'MutableCollection' else ''})
325+
/// ${'- MutatingVariant: sort' if Self == 'MutableCollection' else ''}
326326
public func sorted() -> [Iterator.Element] {
327327
var result = ContiguousArray(self)
328328
result.sort()
@@ -396,7 +396,7 @@ ${orderingExplanation}
396396
/// - Returns: A sorted array of the ${sequenceKind}'s elements.
397397
///
398398
/// - SeeAlso: `sorted()`
399-
@warn_unused_result(${'mutable_variant: "sort"' if Self == 'MutableCollection' else ''})
399+
/// ${'- MutatingVariant: sort' if Self == 'MutableCollection' else ''}
400400
public func sorted(
401401
isOrderedBefore:
402402
@noescape (${IElement}, ${IElement}) -> Bool

test/1_stdlib/Runtime.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import StdlibUnittest
99
import SwiftShims
1010

1111

12-
@warn_unused_result
1312
@_silgen_name("swift_demangle")
1413
public
1514
func _stdlib_demangleImpl(
@@ -20,7 +19,6 @@ func _stdlib_demangleImpl(
2019
flags: UInt32
2120
) -> UnsafeMutablePointer<CChar>?
2221

23-
@warn_unused_result
2422
func _stdlib_demangleName(_ mangledName: String) -> String {
2523
return mangledName.nulTerminatedUTF8.withUnsafeBufferPointer {
2624
(mangledNameUTF8) in

test/IDE/print_ast_tc_decls.swift

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,33 +1284,6 @@ struct d2900_TypeSugar1 {
12841284
// PASS_COMMON-NEXT: {{^}} init(){{$}}
12851285
// PASS_COMMON-NEXT: {{^}}}{{$}}
12861286

1287-
// @warn_unused_result attribute
1288-
public struct ArrayThingy {
1289-
// PASS_PRINT_AST: @warn_unused_result(mutable_variant: "sort")
1290-
// PASS_PRINT_AST-NEXT: public func sort() -> ArrayThingy
1291-
@warn_unused_result(mutable_variant: "sort")
1292-
public func sort() -> ArrayThingy { return self }
1293-
1294-
public mutating func sort() { }
1295-
1296-
// PASS_PRINT_AST: @warn_unused_result(message: "dummy", mutable_variant: "reverseInPlace")
1297-
// PASS_PRINT_AST-NEXT: public func reverse() -> ArrayThingy
1298-
@warn_unused_result(message: "dummy", mutable_variant: "reverseInPlace")
1299-
public func reverse() -> ArrayThingy { return self }
1300-
1301-
public mutating func reverseInPlace() { }
1302-
1303-
// PASS_PRINT_AST: @warn_unused_result
1304-
// PASS_PRINT_AST-NEXT: public func mineGold() -> Int
1305-
@warn_unused_result
1306-
public func mineGold() -> Int { return 0 }
1307-
1308-
// PASS_PRINT_AST: @warn_unused_result(message: "oops")
1309-
// PASS_PRINT_AST-NEXT: public func mineCopper() -> Int
1310-
@warn_unused_result(message: "oops")
1311-
public func mineCopper() -> Int { return 0 }
1312-
}
1313-
13141287
// @discardableResult attribute
13151288
public struct DiscardableThingy {
13161289
// PASS_PRINT_AST: @discardableResult

test/IDE/print_stdlib.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,4 @@ func foo(x: _Pointer) {} // Checks that this protocol actually exists.
9797

9898
// CHECK-FREQUENT-WORD: ///
9999
// CHECK-FREQUENT-WORD-NOT: where Slice<Dictionary<Key, Value>> == Slice<Self>
100-
// CHECK-FREQUENT-WORD-NOT: @warn_unused_result
101100
// CHECK-COLLECTION-GROUP: extension MutableCollection

0 commit comments

Comments
 (0)