Skip to content

Commit 4db9d42

Browse files
committed
unused
1 parent 1221aee commit 4db9d42

File tree

10 files changed

+21
-19
lines changed

10 files changed

+21
-19
lines changed

build.sc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ trait Common extends CrossScalaModule with PublishModule with ScalafixModule{
2727
)
2828
)
2929

30-
def scalacOptions = Seq("-Wunused:imports")
30+
def scalacOptions = Seq("-Xlint:unused")
3131
}
3232

3333

@@ -45,7 +45,7 @@ trait ScalaSql extends Common{
4545

4646

4747
object test extends ScalaTests with ScalafixModule{
48-
def scalacOptions = Seq("-Wunused:imports")
48+
def scalacOptions = Seq("-Xlint:unused")
4949
def ivyDeps = Agg(
5050
ivy"com.github.vertical-blank:sql-formatter:2.0.4",
5151
ivy"com.lihaoyi::mainargs:0.4.0",

scalasql/operations/src/AggOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class AggOps[T](v: Aggregatable[T])(implicit qr: Queryable.Row[T, _], dialect: D
99
import dialect._
1010

1111
/** Counts the rows */
12-
def size: Expr[Int] = v.aggregateExpr(expr => implicit ctx => sql"COUNT(1)")
12+
def size: Expr[Int] = v.aggregateExpr(expr => _ => sql"COUNT(1)")
1313

1414
/** Computes the sum of column values */
1515
def sumBy[V: Numeric: TypeMapper](f: T => Expr[V])(

scalasql/operations/src/DbApiOps.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,37 @@ class DbApiOps(dialect: DialectTypeMappers) {
1616
* with gaps. If there is no ORDER BY clause, then all rows are considered peers and
1717
* this function always returns 1.
1818
*/
19-
def rank(): Expr[Int] = Expr { implicit ctx => sql"RANK()" }
19+
def rank(): Expr[Int] = Expr { _ => sql"RANK()" }
2020

2121
/**
2222
* The number of the row within the current partition. Rows are numbered starting
2323
* from 1 in the order defined by the ORDER BY clause in the window definition, or
2424
* in arbitrary order otherwise.
2525
*/
26-
def rowNumber(): Expr[Int] = Expr { implicit ctx => sql"ROW_NUMBER()" }
26+
def rowNumber(): Expr[Int] = Expr { _ => sql"ROW_NUMBER()" }
2727

2828
/**
2929
* The number of the current row's peer group within its partition - the rank of the
3030
* current row without gaps. Rows are numbered starting from 1 in the order defined
3131
* by the ORDER BY clause in the window definition. If there is no ORDER BY clause,
3232
* then all rows are considered peers and this function always returns 1.
3333
*/
34-
def denseRank(): Expr[Int] = Expr { implicit ctx => sql"DENSE_RANK()" }
34+
def denseRank(): Expr[Int] = Expr { _ => sql"DENSE_RANK()" }
3535

3636
/**
3737
* Despite the name, this function always returns a value between 0.0 and 1.0 equal to
3838
* (rank - 1)/(partition-rows - 1), where rank is the value returned by built-in window
3939
* function rank() and partition-rows is the total number of rows in the partition. If
4040
* the partition contains only one row, this function returns 0.0.
4141
*/
42-
def percentRank(): Expr[Double] = Expr { implicit ctx => sql"PERCENT_RANK()" }
42+
def percentRank(): Expr[Double] = Expr { _ => sql"PERCENT_RANK()" }
4343

4444
/**
4545
* The cumulative distribution. Calculated as row-number/partition-rows, where row-number
4646
* is the value returned by row_number() for the last peer in the group and partition-rows
4747
* the number of rows in the partition.
4848
*/
49-
def cumeDist(): Expr[Double] = Expr { implicit ctx => sql"CUME_DIST()" }
49+
def cumeDist(): Expr[Double] = Expr { _ => sql"CUME_DIST()" }
5050

5151
/**
5252
* Argument N is handled as an integer. This function divides the partition into N groups
@@ -55,7 +55,7 @@ class DbApiOps(dialect: DialectTypeMappers) {
5555
* groups occur first. This function returns the integer value assigned to the group that
5656
* the current row is a part of.
5757
*/
58-
def ntile(n: Int): Expr[Int] = Expr { implicit ctx => sql"NTILE($n)" }
58+
def ntile(n: Int): Expr[Int] = Expr { _ => sql"NTILE($n)" }
5959

6060
private def lagLead[T](prefix: SqlStr, e: Expr[T], offset: Int, default: Expr[T]): Expr[T] =
6161
Expr { implicit ctx =>

scalasql/operations/src/ExprOptionOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ class ExprOptionOps[T: TypeMapper](v: Expr[Option[T]])(implicit dialect: Dialect
3535

3636
def filter(other: Expr[T] => Expr[Boolean]): Expr[Option[T]] = new CaseWhen.Else[Option[T]](
3737
Seq(other(Expr[T] { implicit ctx: Context => sql"$v" }) -> v),
38-
Expr { implicit ctx => sql"NULL" }
38+
Expr { _ => sql"NULL" }
3939
)
4040
}

scalasql/operations/src/MathOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ trait MathOps {
5656
}
5757

5858
/** Returns the value of Pi */
59-
def pi: Expr[Double] = Expr { implicit ctx => sql"PI()" }
59+
def pi: Expr[Double] = Expr { _ => sql"PI()" }
6060

6161
}

scalasql/src/dialects/MySqlDialect.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ object MySqlDialect extends MySqlDialect {
126126
/**
127127
* Returns a random value in the range 0.0 <= x < 1.0
128128
*/
129-
def rand: Expr[Double] = Expr { implicit ctx => sql"RAND()" }
129+
def rand: Expr[Double] = Expr { _ => sql"RAND()" }
130130
}
131131

132132
class ExprAggOps[T](v: Aggregatable[Expr[T]]) extends scalasql.operations.ExprAggOps[T](v) {

scalasql/src/dialects/PostgresDialect.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ object PostgresDialect extends PostgresDialect {
7676
/**
7777
* Returns a random value in the range 0.0 <= x < 1.0
7878
*/
79-
def random: Expr[Double] = Expr { implicit ctx => sql"RANDOM()" }
79+
def random: Expr[Double] = Expr { _ => sql"RANDOM()" }
8080
}
8181

8282
class ExprAggOps[T](v: Aggregatable[Expr[T]]) extends scalasql.operations.ExprAggOps[T](v) {

scalasql/src/dialects/SqliteDialect.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ object SqliteDialect extends SqliteDialect {
5959
* changes() SQL function is a wrapper around the sqlite3_changes64() C/C++
6060
* function and hence follows the same rules for counting changes.
6161
*/
62-
def changes: Expr[Int] = Expr { implicit ctx => sql"CHANGES()" }
62+
def changes: Expr[Int] = Expr { _ => sql"CHANGES()" }
6363

6464
/**
6565
* The total_changes() function returns the number of row changes caused by
6666
* INSERT, UPDATE or DELETE statements since the current database connection
6767
* was opened. This function is a wrapper around the sqlite3_total_changes64()
6868
* C/C++ interface.
6969
*/
70-
def totalChanges: Expr[Int] = Expr { implicit ctx => sql"TOTAL_CHANGES()" }
70+
def totalChanges: Expr[Int] = Expr { _ => sql"TOTAL_CHANGES()" }
7171

7272
/**
7373
* The typeof(X) function returns a string that indicates the datatype of the
@@ -81,13 +81,13 @@ object SqliteDialect extends SqliteDialect {
8181
* last_insert_rowid() SQL function is a wrapper around the
8282
* sqlite3_last_insert_rowid() C/C++ interface function.
8383
*/
84-
def lastInsertRowId: Expr[Int] = Expr { implicit ctx => sql"LAST_INSERT_ROWID()" }
84+
def lastInsertRowId: Expr[Int] = Expr { _ => sql"LAST_INSERT_ROWID()" }
8585

8686
/**
8787
* The random() function returns a pseudo-random integer between
8888
* -9223372036854775808 and +9223372036854775807.
8989
*/
90-
def random: Expr[Long] = Expr { implicit ctx => sql"RANDOM()" }
90+
def random: Expr[Long] = Expr { _ => sql"RANDOM()" }
9191

9292
/**
9393
* The randomblob(N) function return an N-byte blob containing pseudo-random bytes.

scalasql/test/src/FailureTests.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import scalasql.core.Expr
33
import utest._
44
import utils.SqliteSuite
55

6+
import scala.annotation.unused
7+
68
/**
79
* Tests for all the aggregate operators that we provide by default
810
*/
@@ -21,7 +23,7 @@ object FailureTests extends SqliteSuite {
2123
val ex = intercept[Exception] { Expr(1).toString }
2224
assert(ex.getMessage.contains("Expr#toString is not defined"))
2325

24-
val s: String = Expr.toString(Expr(1))
26+
@unused val s: String = Expr.toString(Expr(1))
2527
}
2628

2729
}

scalasql/test/src/WorldSqlTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ object WorldSqlTests extends TestSuite {
13301330
// is rolled back and all changes are undoned (as seen below)
13311331
dbClient.transaction { implicit db =>
13321332
try {
1333-
db.savepoint { implicit sp =>
1333+
db.savepoint { _ =>
13341334
db.run(City.delete(_.countryCode === "SGP"))
13351335

13361336
db.run(City.select.filter(_.countryCode === "SGP")) ==> Seq()

0 commit comments

Comments
 (0)