Skip to content

Commit

Permalink
Merge pull request #605 from xuwei-k/auto-application-warnings
Browse files Browse the repository at this point in the history
fix `Auto-application` warnings
  • Loading branch information
mkurz authored Jan 23, 2022
2 parents a624066 + 194a415 commit 4f9e296
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions samples/basic/app/controllers/Application.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ class Application @Inject() (
"color" -> text())(Dog.apply)(Dog.unapply))

def insertCat = Action.async { implicit request =>
val cat: Cat = catForm.bindFromRequest.get
val cat: Cat = catForm.bindFromRequest().get
catDao.insert(cat).map(_ => Redirect(routes.Application.index))
}

def insertDog = Action.async { implicit request =>
val dog: Dog = dogForm.bindFromRequest.get
val dog: Dog = dogForm.bindFromRequest().get
dogDao.insert(dog).map(_ => Redirect(routes.Application.index))
}
}
4 changes: 2 additions & 2 deletions samples/computer-database/app/controllers/Application.scala
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Application @Inject() (
* @param id Id of the computer to edit
*/
def update(id: Long) = Action.async { implicit rs =>
computerForm.bindFromRequest.fold(
computerForm.bindFromRequest().fold(
formWithErrors => companiesDao.options().map(options => BadRequest(html.editForm(id, formWithErrors, options))),
computer => {
for {
Expand All @@ -89,7 +89,7 @@ class Application @Inject() (

/** Handle the 'new computer form' submission. */
def save = Action.async { implicit rs =>
computerForm.bindFromRequest.fold(
computerForm.bindFromRequest().fold(
formWithErrors => companiesDao.options().map(options => BadRequest(html.createForm(formWithErrors, options))),
computer => {
for {
Expand Down
6 changes: 3 additions & 3 deletions src/core/src/test/scala/play/api/db/slick/SlickApiSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ class SlickApiSpec extends Specification {
"SlickApi.dbConfigs" should {
"return all DatabaseConfig instances for a valid configuration" in {
import SUTWithGoodConfig._
api.dbConfigs[BasicProfile] must have size 4
api.dbConfigs[BasicProfile]() must have size 4
}
"throw if a database name doesn't exist in the config" in {
import SUTWithBadConfig._
api.dbConfigs[BasicProfile] must throwA[PlayException]
api.dbConfigs[BasicProfile]() must throwA[PlayException]
}
"throw if a database config doesn't define a Slick profile" in {
import SUTWithBadConfig._
api.dbConfigs[BasicProfile] must throwA[PlayException]
api.dbConfigs[BasicProfile]() must throwA[PlayException]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private[evolutions] class DBApiAdapter @Inject() (slickApi: SlickApi) extends DB
}
.toMap

override def databases: Seq[PlayDatabase] = databasesByName.values.toSeq
override def databases(): Seq[PlayDatabase] = databasesByName.values.toSeq

def database(name: String): PlayDatabase =
databasesByName.getOrElse(DbName(name), throw new IllegalArgumentException(s"Could not find database for $name"))
Expand Down

0 comments on commit 4f9e296

Please sign in to comment.