commit stringlengths 40 40 | old_file stringlengths 4 236 | new_file stringlengths 4 236 | old_contents stringlengths 1 3.26k | new_contents stringlengths 16 4.43k | subject stringlengths 16 624 | message stringlengths 17 3.29k | lang stringclasses 5
values | license stringclasses 13
values | repos stringlengths 5 91.5k |
|---|---|---|---|---|---|---|---|---|---|
0dee89c8be4adad65ee804bf031bd07ee473fbe5 | modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/TestDirective.kt | modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/TestDirective.kt | package com.beust.kobalt
import com.beust.kobalt.api.Project
import com.beust.kobalt.api.annotation.Directive
class TestConfig(val project: Project) {
val testArgs = arrayListOf<String>()
val jvmArgs = arrayListOf<String>()
val testIncludes = arrayListOf("**/*Test.class")
val testExcludes = arrayListO... | package com.beust.kobalt
import com.beust.kobalt.api.Project
import com.beust.kobalt.api.annotation.Directive
class TestConfig(val project: Project) {
val testArgs = arrayListOf<String>()
val jvmArgs = arrayListOf<String>()
val testIncludes = arrayListOf("**/*Test.class")
val testExcludes = arrayListO... | Clear the test configurations before adding new ones. | Clear the test configurations before adding new ones.
| Kotlin | apache-2.0 | ethauvin/kobalt,cbeust/kobalt,evanchooly/kobalt,evanchooly/kobalt,evanchooly/kobalt,cbeust/kobalt,ethauvin/kobalt,ethauvin/kobalt,ethauvin/kobalt,evanchooly/kobalt,cbeust/kobalt |
45c002784afa7ceb93961c37055fcbe9752ffc8f | subprojects/docs/src/snippets/wrapper/customized-task/kotlin/build.gradle.kts | subprojects/docs/src/snippets/wrapper/customized-task/kotlin/build.gradle.kts | // tag::customized-wrapper-task[]
tasks.named<Wrapper>("wrapper") {
distributionType = Wrapper.DistributionType.ALL
}
// end::customized-wrapper-task[]
| // tag::customized-wrapper-task[]
tasks.wrapper {
distributionType = Wrapper.DistributionType.ALL
}
// end::customized-wrapper-task[]
| Use the type-safe accessor in Kotlin doc snippet | Use the type-safe accessor in Kotlin doc snippet
Signed-off-by: Björn Kautler <74e2ee7aa8c396759a26a42a85f2923ab73a4ea5@Kautler.net>
| Kotlin | apache-2.0 | blindpirate/gradle,gradle/gradle,blindpirate/gradle,gradle/gradle,gradle/gradle,blindpirate/gradle,blindpirate/gradle,gradle/gradle,gradle/gradle,blindpirate/gradle,blindpirate/gradle,blindpirate/gradle,gradle/gradle,gradle/gradle,gradle/gradle,blindpirate/gradle,blindpirate/gradle,blindpirate/gradle,gradle/gradle,grad... |
553de58e1f29f685f402ad382253ba34cc096d91 | app/src/main/kotlin/com/github/ramonrabello/kiphy/common/arch/state/Result.kt | app/src/main/kotlin/com/github/ramonrabello/kiphy/common/arch/state/Result.kt | package com.github.ramonrabello.kiphy.common.arch.state
/**
* Sealed class that represents data state whether if
* it is success or errors.
*/
sealed class Result<out T : Any> {
class Success<out T : Any>(val value: T) : Result<T>()
sealed class Error : Result<Nothing>() {
object NetworkError : Erro... | package com.github.ramonrabello.kiphy.common.arch.state
/**
* Sealed class that represents data state whether if
* it is success or errors.
*/
sealed class Result<out T : Any> {
class Success<out T : Any>(val value: T) : Result<T>()
sealed class Error : Result<Nothing>() {
class NetworkError(error: ... | Refactor NetworkError to receive Throwable parameter. | Refactor NetworkError to receive Throwable parameter.
| Kotlin | apache-2.0 | ramonrabello/Kiphy |
7b6541b38540852657ed67a6125a96c7c7d7253c | javalin/src/main/java/io/javalin/http/ContextResolver.kt | javalin/src/main/java/io/javalin/http/ContextResolver.kt | package io.javalin.http
import io.javalin.core.util.Header
import javax.servlet.http.HttpServletRequest
const val CONTEXT_RESOLVER_KEY = "contextResolver"
fun Context.contextResolver() = this.appAttribute<ContextResolver>(CONTEXT_RESOLVER_KEY)
class ContextResolver {
var ip: (Context) -> String = { it.req.remo... | package io.javalin.http
import io.javalin.core.util.Header
import javax.servlet.http.HttpServletRequest
const val CONTEXT_RESOLVER_KEY = "contextResolver"
fun Context.contextResolver() = this.appAttribute<ContextResolver>(CONTEXT_RESOLVER_KEY)
class ContextResolver {
// @formatter:off
@JvmField var ip: (Co... | Make context resolvers jvm fields | [config] Make context resolvers jvm fields
| Kotlin | apache-2.0 | tipsy/javalin,tipsy/javalin,tipsy/javalin,tipsy/javalin |
67edf9126a67b2d0fd94c5894efe7f5bd2bbe3c8 | platform/util-ex/src/com/intellij/openapi/util/extensions.kt | platform/util-ex/src/com/intellij/openapi/util/extensions.kt | // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.util
/** Allows deconstruction of `com.intellij.openapi.util.Pair`. */
operator fun <A, B> Pair<A, B>.component1(): A = this.first
operator fun <A, B... | // Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.util
import com.intellij.openapi.Disposable
/** Allows deconstruction of `com.intellij.openapi.util.Pair`. */
operator fun <A, B> Pair<A, B>.compone... | Move `Disposable.use` convenience method to `intellij.platform.util.ex` | Move `Disposable.use` convenience method to `intellij.platform.util.ex`
GitOrigin-RevId: 82c3aba9e0511b7277127e1077582571ef0e3d40 | Kotlin | apache-2.0 | allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/int... |
ac63aa174bd29217ac3f683281db9977b8dbba3b | leakcanary-android-instrumentation/src/androidTest/java/leakcanary/TestUtils.kt | leakcanary-android-instrumentation/src/androidTest/java/leakcanary/TestUtils.kt | package leakcanary
import leakcanary.InstrumentationLeakDetector.Result.AnalysisPerformed
import leakcanary.InstrumentationLeakDetector.Result.NoAnalysis
import shark.HeapAnalysisSuccess
object TestUtils {
fun assertLeak(expectedLeakClass: Class<*>) {
val leakDetector = InstrumentationLeakDetector()
val he... | package leakcanary
import shark.HeapAnalysis
import shark.HeapAnalysisSuccess
object TestUtils {
fun assertLeak(expectedLeakClass: Class<*>) {
var heapAnalysisOrNull: HeapAnalysis? = null
AndroidDetectLeaksAssert { heapAnalysis ->
heapAnalysisOrNull = heapAnalysis
}.assertNoLeaks("")
if (heap... | Migrate TestUtil to use the newer API | Migrate TestUtil to use the newer API
| Kotlin | apache-2.0 | square/leakcanary,square/leakcanary,square/leakcanary |
ec3a69b3b0aaf9482908bc6242722599e4811401 | ktor-server/ktor-server-host-common/src/io/ktor/server/engine/ApplicationEngine.kt | ktor-server/ktor-server-host-common/src/io/ktor/server/engine/ApplicationEngine.kt | package io.ktor.server.engine
import java.util.concurrent.*
/**
* Engine which runs an application
*/
interface ApplicationEngine {
/**
* Configuration for the [ApplicationEngine]
*/
open class Configuration {
/**
* Provides currently available parallelism, e.g. number of availab... | package io.ktor.server.engine
import java.util.concurrent.*
/**
* Engine which runs an application
*/
interface ApplicationEngine {
/**
* Configuration for the [ApplicationEngine]
*/
open class Configuration {
/**
* Provides currently available parallelism, e.g. number of availab... | Fix documentation inaccuracy in stop() | Fix documentation inaccuracy in stop()
Fix error in documentation which wrongly claims that the gradePeriod is in millis. In reality both the gradeperiod and the timeout is applied to the timeUnit specified as the third argument.
If one specifies `stop(1_000, 20, TimeUnit.SECONDS)`an `java.lang.IllegalArgumentExcepti... | Kotlin | apache-2.0 | ktorio/ktor,ktorio/ktor,ktorio/ktor,ktorio/ktor |
cf8b6685f8fcadb3f50999ee587c7316741808f9 | kotlin/src/main/kotlin/2018/Lib05.kt | kotlin/src/main/kotlin/2018/Lib05.kt | package aoc.kt.y2018;
/**
* Day 5.
*/
/** Part 1 */
fun processPolymer1(input: String): String {
val output = input.toCharArray()
.forEachIndexed { i, c ->
if (i != 0) {
var reacting = true
var range = 0..0
while (reacting) {
var offset = 0
... | package aoc.kt.y2018;
/**
* Day 5.
*/
/** Part 1 */
fun processPolymer1(input: String): String {
var polymer = Pair(input, true)
while (polymer.second) {
polymer = react(polymer.first)
}
return polymer
//.first.length
.toString()
}
/** Part 2 */
fun processPolymer2(input: S... | Update with new approach to day 5 | Update with new approach to day 5
| Kotlin | mit | nathanjent/adventofcode-rust |
c8afb4426c3a34b28fc4de8b006c5bddae053f8f | subprojects/docs/src/snippets/multiproject/customLayout/kotlin/settings.gradle.kts | subprojects/docs/src/snippets/multiproject/customLayout/kotlin/settings.gradle.kts | include ("project-a", "project-b")
// tag::lookup-project[]
println(rootProject.name)
println(project(":project-a").name)
// end::lookup-project[]
// tag::change-project[]
rootProject.name = "main"
project(":project-a").projectDir = file("../my-project-a")
project(":project-a").buildFileName = "project-a.gradle"
// e... | // tag::change-project[]
rootProject.name = "main"
// tag::lookup-project[]
include("project-a")
// end::change-project[]
println(rootProject.name)
println(project(":project-a").name)
// end::lookup-project[]
// tag::change-project[]
project(":project-a").projectDir = file("../my-project-a")
project(":project-a").buil... | Align Kotlin snippet multiproject/customLayout with Groovy | Align Kotlin snippet multiproject/customLayout with Groovy
| Kotlin | apache-2.0 | gradle/gradle,gradle/gradle,gradle/gradle,gradle/gradle,gradle/gradle,gradle/gradle,gradle/gradle,gradle/gradle,gradle/gradle,gradle/gradle |
b78795a6e8218759a994881c582abee8b77c3506 | android-app/src/main/java/fr/cph/chicago/entity/PatternPoint.kt | android-app/src/main/java/fr/cph/chicago/entity/PatternPoint.kt | /**
* Copyright 2017 Carl-Philipp Harmant
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable la... | /**
* Copyright 2017 Carl-Philipp Harmant
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable la... | Remove parecable from pattern point | Remove parecable from pattern point
| Kotlin | apache-2.0 | carlphilipp/chicago-commutes,carlphilipp/chicago-commutes,carlphilipp/chicago-commutes |
d6bf92fdddf5ffb48b5915d58eeeddf554c07073 | kotlin-eclipse-core/src/org/jetbrains/kotlin/core/model/scriptTemplateProviderEP.kt | kotlin-eclipse-core/src/org/jetbrains/kotlin/core/model/scriptTemplateProviderEP.kt | package org.jetbrains.kotlin.core.model
import org.eclipse.core.runtime.IConfigurationElement
import org.eclipse.core.runtime.Platform
import org.jetbrains.kotlin.script.KotlinScriptDefinitionFromTemplate
import org.jetbrains.kotlin.script.ScriptTemplateProvider
import org.jetbrains.kotlin.script.makeScriptDefsFromTem... | package org.jetbrains.kotlin.core.model
import org.eclipse.core.runtime.CoreException
import org.eclipse.core.runtime.IConfigurationElement
import org.eclipse.core.runtime.Platform
import org.jetbrains.kotlin.core.log.KotlinLogger
import org.jetbrains.kotlin.script.KotlinScriptDefinitionFromTemplate
import org.jetbrai... | Add error handling for script template provider extension point | Add error handling for script template provider extension point
| Kotlin | apache-2.0 | noemus/kotlin-eclipse,noemus/kotlin-eclipse |
49154c02a7cf518675a3b0d448bd79d62dfa4b00 | proto-actor/src/main/kotlin/actor/proto/DeferredProcess.kt | proto-actor/src/main/kotlin/actor/proto/DeferredProcess.kt | package actor.proto
import actor.proto.mailbox.SystemMessage
import kotlinx.coroutines.experimental.CompletableDeferred
import kotlinx.coroutines.experimental.withTimeout
import java.time.Duration
import java.util.concurrent.TimeUnit
class DeferredProcess<out T>(private val timeout: Duration = Duration.ofMillis(5000)... | package actor.proto
import actor.proto.mailbox.SystemMessage
import kotlinx.coroutines.experimental.CompletableDeferred
import kotlinx.coroutines.experimental.withTimeout
import java.time.Duration
import java.util.concurrent.TimeUnit
class DeferredProcess<out T>(private val timeout: Duration = Duration.ofMillis(5000)... | Remove from registry when an exception (including timeout) occurs | Remove from registry when an exception (including timeout) occurs
| Kotlin | apache-2.0 | AsynkronIT/protoactor-kotlin,AsynkronIT/protoactor-kotlin,AsynkronIT/protoactor-kotlin |
6be249f86ea39d69be28704fd585e16c72268d59 | src/main/kotlin/net/yested/core/properties/validators.kt | src/main/kotlin/net/yested/core/properties/validators.kt | package net.yested.core.properties
class ValidationStatus(
val success: Boolean,
val errorMessage: String) {
override fun toString() = if (success) "OK" else "Error: $errorMessage"
}
fun <T> ReadOnlyProperty<T>.validate(errorMessage: String, condition: (T) -> Boolean) =
this.map {
... | package net.yested.core.properties
class ValidationStatus(
val success: Boolean,
val errorMessage: String) {
override fun toString() = if (success) "OK" else "Error: $errorMessage"
}
fun <T> ReadOnlyProperty<T>.validate(errorMessage: String, condition: (T) -> Boolean): ReadOnlyProperty<ValidationS... | Make fun return type explicit for validator. | Make fun return type explicit for validator.
| Kotlin | mit | jean79/yested_fw,jean79/yested_fw |
5ceb637b3373419e86961e236517032efac392c2 | ground/src/main/java/com/google/android/ground/rx/BooleanOrError.kt | ground/src/main/java/com/google/android/ground/rx/BooleanOrError.kt | /*
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... | /*
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... | Convert to data class and replace with Result | Convert to data class and replace with Result
| Kotlin | apache-2.0 | google/ground-android,google/ground-android,google/ground-android |
8dc991a842d10e858b014dc91ae2897d05f9f7ca | src/test/kotlin/mixit/integration/AbstractIntegrationTests.kt | src/test/kotlin/mixit/integration/AbstractIntegrationTests.kt | package mixit.integration
import org.junit.Before
import org.junit.runner.RunWith
import org.springframework.boot.context.embedded.LocalServerPort
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment
import org.springframework.test.conte... | package mixit.integration
import org.junit.Before
import org.junit.runner.RunWith
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment
import org.springframework.boot.web.server.LocalServerPort
import org.springframework.test.context.jun... | Update LocalServerPort against latest Boot snapshots | Update LocalServerPort against latest Boot snapshots
| Kotlin | apache-2.0 | mix-it/mixit,mix-it/mixit,mixitconf/mixit,sdeleuze/mixit,mixitconf/mixit,mix-it/mixit,mixitconf/mixit,mix-it/mixit,sdeleuze/mixit,sdeleuze/mixit,mixitconf/mixit,mix-it/mixit,sdeleuze/mixit |
201e0145c8912ddc335208ffb52b2a2cb3837a7e | app/src/main/java/net/squanchy/tweets/service/TwitterService.kt | app/src/main/java/net/squanchy/tweets/service/TwitterService.kt | package net.squanchy.tweets.service
import io.reactivex.Observable
import io.reactivex.functions.BiFunction
import net.squanchy.service.firestore.FirestoreDbService
import net.squanchy.tweets.domain.view.TwitterScreenViewModel
import net.squanchy.tweets.view.TweetUrlSpanFactory
internal class TwitterService(
dbSe... | package net.squanchy.tweets.service
import io.reactivex.Observable
import io.reactivex.functions.BiFunction
import net.squanchy.service.firestore.FirestoreDbService
import net.squanchy.tweets.domain.view.TwitterScreenViewModel
import net.squanchy.tweets.view.TweetUrlSpanFactory
internal class TwitterService(
dbSe... | Sort tweets by descending creation date (most recent first) | Sort tweets by descending creation date (most recent first)
| Kotlin | apache-2.0 | squanchy-dev/squanchy-android,squanchy-dev/squanchy-android,squanchy-dev/squanchy-android |
9947ebbb88338f860e1e0138f7b6235f696fae4a | .teamcity/Gradle_Util/buildTypes/WarmupEc2Agent.kt | .teamcity/Gradle_Util/buildTypes/WarmupEc2Agent.kt | package Gradle_Util.buildTypes
import common.gradleWrapper
import configurations.buildJavaHome
import jetbrains.buildServer.configs.kotlin.v2019_2.AbsoluteId
import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType
import jetbrains.buildServer.configs.kotlin.v2019_2.CheckoutMode
import jetbrains.buildServer.confi... | package Gradle_Util.buildTypes
import common.Os
import common.buildToolGradleParameters
import common.builtInRemoteBuildCacheNode
import common.gradleWrapper
import configurations.buildJavaHome
import jetbrains.buildServer.configs.kotlin.v2019_2.AbsoluteId
import jetbrains.buildServer.configs.kotlin.v2019_2.BuildType
... | Enable build scans for EC2 warmup build | Enable build scans for EC2 warmup build
| Kotlin | apache-2.0 | gradle/gradle,blindpirate/gradle,gradle/gradle,gradle/gradle,gradle/gradle,gradle/gradle,gradle/gradle,blindpirate/gradle,gradle/gradle,blindpirate/gradle,gradle/gradle,blindpirate/gradle,blindpirate/gradle,gradle/gradle,blindpirate/gradle,blindpirate/gradle,blindpirate/gradle,blindpirate/gradle,blindpirate/gradle,grad... |
c3872753354940f7fbe1dccad58783ad11906c73 | keystore/src/main/kotlin/org/kethereum/keystore/api/KeyStore.kt | keystore/src/main/kotlin/org/kethereum/keystore/api/KeyStore.kt | package org.kethereum.keystore.api
import org.kethereum.model.Address
import org.kethereum.model.ECKeyPair
interface KeyStore {
fun addKey(key: ECKeyPair, password: String, light: Boolean = false): Address?
fun deleteKey(address: Address): Boolean
fun getKeyForAddress(address: Address, password: String): ... | package org.kethereum.keystore.api
import org.kethereum.model.Address
import org.kethereum.model.ECKeyPair
interface KeyStore {
fun addKey(key: ECKeyPair, password: String = "", light: Boolean = false): Address?
fun deleteKey(address: Address): Boolean
fun getKeyForAddress(address: Address, password: Stri... | Make password optional with default parameter | Make password optional with default parameter
| Kotlin | mit | walleth/kethereum |
0e3429f844e4acb1e8488c1292257d18ca11239a | src/main/java/io/gitlab/arturbosch/tinbo/common/BackCommand.kt | src/main/java/io/gitlab/arturbosch/tinbo/common/BackCommand.kt | package io.gitlab.arturbosch.tinbo.common
import io.gitlab.arturbosch.tinbo.api.Command
import io.gitlab.arturbosch.tinbo.config.ModeAdvisor
import io.gitlab.arturbosch.tinbo.providers.PromptProvider
import io.gitlab.arturbosch.tinbo.utils.printlnInfo
import org.springframework.beans.factory.annotation.Autowired
impor... | package io.gitlab.arturbosch.tinbo.common
import io.gitlab.arturbosch.tinbo.api.Command
import io.gitlab.arturbosch.tinbo.config.ModeAdvisor
import io.gitlab.arturbosch.tinbo.providers.PromptProvider
import io.gitlab.arturbosch.tinbo.utils.printlnInfo
import org.springframework.beans.factory.annotation.Autowired
impor... | Use PrintlnInfo in back command | Use PrintlnInfo in back command
| Kotlin | apache-2.0 | arturbosch/TiNBo,arturbosch/TiNBo,arturbosch/TiNBo |
d63e7208fbc7983d58946f539f81e6372c5d5479 | src/main/kotlin/models/Image.kt | src/main/kotlin/models/Image.kt | package models
/**
* Created by allen on 3/29/17.
*/
data class Image(val id: String, val versionId: String, val path: String, var thumbnail: Thumbnail?) | package models
/**
* Created by allen on 3/29/17.
*/
data class Image(val id: String, val versionId: String, val path: String, var thumbnail: Thumbnail?){
fun equals(otherImage: Image): Boolean {
return otherImage.id == this.id
}
} | Add custom equals method to image data class | Add custom equals method to image data class
| Kotlin | mit | allen-garvey/photog-spark,allen-garvey/photog-spark,allen-garvey/photog-spark |
a1f8182123ec7c255173ffa5e7d80a51159edc3e | src/main/kotlin/net/moltendorf/Bukkit/IntelliDoors/IntelliDoors.kt | src/main/kotlin/net/moltendorf/Bukkit/IntelliDoors/IntelliDoors.kt | package net.moltendorf.Bukkit.IntelliDoors
import net.moltendorf.Bukkit.IntelliDoors.listener.Interact
import net.moltendorf.Bukkit.IntelliDoors.listener.Redstone
import org.bukkit.plugin.java.JavaPlugin
/**
* Created by moltendorf on 15/05/23.
* @author moltendorf
*/
class IntelliDoors : JavaPlugin() {
// Vari... | package net.moltendorf.Bukkit.IntelliDoors
import net.moltendorf.Bukkit.IntelliDoors.listener.Interact
import net.moltendorf.Bukkit.IntelliDoors.listener.Redstone
import org.bukkit.plugin.java.JavaPlugin
import kotlin.concurrent.timer
/**
* Created by moltendorf on 15/05/23.
* @author moltendorf
*/
class IntelliD... | Add some more logs for when the plugin enables | Add some more logs for when the plugin enables
| Kotlin | mit | moltendorf/IntelliDoors |
0bed60ce1edb898d9b9ccba12b656bfd39857df8 | web/src/main/kotlin/app/himawari/filter/UserMDCInsertingServletFilter.kt | web/src/main/kotlin/app/himawari/filter/UserMDCInsertingServletFilter.kt | package app.himawari.filter
import org.slf4j.MDC
import org.springframework.core.Ordered
import org.springframework.core.annotation.Order
import org.springframework.security.core.context.SecurityContextHolder
import org.springframework.security.core.userdetails.UserDetails
import org.springframework.stereotype.Compone... | package app.himawari.filter
import org.slf4j.MDC
import org.springframework.core.Ordered
import org.springframework.core.annotation.Order
import org.springframework.security.core.context.SecurityContextHolder
import org.springframework.security.core.userdetails.UserDetails
import org.springframework.stereotype.Compone... | Change val variable to static. | Change val variable to static.
| Kotlin | mit | cxpqwvtj/himawari,cxpqwvtj/himawari,cxpqwvtj/himawari,cxpqwvtj/himawari,cxpqwvtj/himawari,cxpqwvtj/himawari,cxpqwvtj/himawari |
4d859a3436580c2dead33104cac7c0e572c1ad36 | buildSrc/subprojects/profiling/profiling.gradle.kts | buildSrc/subprojects/profiling/profiling.gradle.kts | dependencies {
implementation("me.champeau.gradle:jmh-gradle-plugin:0.4.8")
implementation("org.jsoup:jsoup:1.11.3")
implementation("com.gradle:build-scan-plugin:2.1")
implementation(project(":configuration"))
implementation(project(":kotlinDsl"))
implementation(project(":plugins"))
implemen... | dependencies {
implementation("me.champeau.gradle:jmh-gradle-plugin:0.4.8")
implementation("org.jsoup:jsoup:1.11.3")
implementation("com.gradle:build-scan-plugin:2.2-rc-1-20190226165117-release")
implementation(project(":configuration"))
implementation(project(":kotlinDsl"))
implementation(proje... | Update supported build scan plugin to 2.2-rc-1 | Update supported build scan plugin to 2.2-rc-1
| Kotlin | apache-2.0 | robinverduijn/gradle,gradle/gradle,blindpirate/gradle,gradle/gradle,robinverduijn/gradle,robinverduijn/gradle,gradle/gradle,robinverduijn/gradle,robinverduijn/gradle,robinverduijn/gradle,gradle/gradle,blindpirate/gradle,robinverduijn/gradle,blindpirate/gradle,gradle/gradle,gradle/gradle,blindpirate/gradle,robinverduijn... |
da5b673ac234d3209da876a128d00b795a363572 | kotpref/src/main/kotlin/com/chibatching/kotpref/KotprefPreferences.kt | kotpref/src/main/kotlin/com/chibatching/kotpref/KotprefPreferences.kt | package com.chibatching.kotpref
import android.annotation.TargetApi
import android.content.SharedPreferences
import android.os.Build
import com.chibatching.kotpref.pref.StringSetPref
internal class KotprefPreferences(val preferences: SharedPreferences) : SharedPreferences by preferences {
override fun edit(): S... | package com.chibatching.kotpref
import android.annotation.TargetApi
import android.content.SharedPreferences
import android.os.Build
import com.chibatching.kotpref.pref.StringSetPref
import java.util.*
internal class KotprefPreferences(val preferences: SharedPreferences) : SharedPreferences by preferences {
ove... | Remove java 8 api call to avoid crash on Android | Remove java 8 api call to avoid crash on Android
| Kotlin | apache-2.0 | chibatching/Kotpref |
4ac7b0ffb2ac94b2258c9ba7b4cc7222e162b14d | src/main/kotlin/mixit/repository/TicketRepository.kt | src/main/kotlin/mixit/repository/TicketRepository.kt | package mixit.repository
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import mixit.model.Ticket
import org.slf4j.LoggerFactory
import org.springframework.core.io.ClassPathResource
import org.springframework.data.mongodb.core.*
import org.springframework.data.m... | package mixit.repository
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import mixit.model.Ticket
import org.slf4j.LoggerFactory
import org.springframework.core.io.ClassPathResource
import org.springframework.data.mongodb.core.*
import org.springframework.data.m... | Revert "Prepare lottery: remove all tickets from 2019" | Revert "Prepare lottery: remove all tickets from 2019"
This reverts commit 74c374ff
| Kotlin | apache-2.0 | mix-it/mixit,mix-it/mixit,mixitconf/mixit,mix-it/mixit,mixitconf/mixit,mix-it/mixit,mixitconf/mixit,mixitconf/mixit,mix-it/mixit |
e48efcf64c3568be32d96c1dc2a139b56206e9a5 | detekt-core/src/main/kotlin/io/gitlab/arturbosch/detekt/core/KtFiles.kt | detekt-core/src/main/kotlin/io/gitlab/arturbosch/detekt/core/KtFiles.kt | package io.gitlab.arturbosch.detekt.core
import org.jetbrains.kotlin.fileClasses.javaFileFacadeFqName
import org.jetbrains.kotlin.psi.KtFile
/**
* @author Artur Bosch
*/
fun KtFile.unnormalizedContent(): String {
val lineSeparator = this.getUserData(KtCompiler.LINE_SEPARATOR)
require(lineSeparator != null) { "No... | package io.gitlab.arturbosch.detekt.core
import org.jetbrains.kotlin.com.intellij.openapi.util.text.StringUtilRt
import org.jetbrains.kotlin.fileClasses.javaFileFacadeFqName
import org.jetbrains.kotlin.psi.KtFile
/**
* @author Artur Bosch
*/
fun KtFile.unnormalizedContent(): String {
val lineSeparator = this.getU... | Use idea intern line separator replacement | Use idea intern line separator replacement
| Kotlin | apache-2.0 | arturbosch/detekt,arturbosch/detekt,Mauin/detekt,rock3r/detekt,Mauin/detekt,arturbosch/detekt,MyDogTom/detekt,rock3r/detekt,Mauin/detekt,Mauin/detekt,rock3r/detekt |
22517e8658df76ebd8f9957f27384e1701d10b6e | plugin-dotnet-agent/src/main/kotlin/jetbrains/buildServer/agent/EnvironmentImpl.kt | plugin-dotnet-agent/src/main/kotlin/jetbrains/buildServer/agent/EnvironmentImpl.kt | package jetbrains.buildServer.agent
import jetbrains.buildServer.agent.impl.OSTypeDetector
import jetbrains.buildServer.util.OSType
import jetbrains.buildServer.util.StringUtil
import java.io.File
class EnvironmentImpl(private val _fileSystemService: FileSystemService) : Environment {
override fun tryGetVariable(... | package jetbrains.buildServer.agent
import jetbrains.buildServer.agent.impl.OSTypeDetector
import jetbrains.buildServer.util.OSType
import jetbrains.buildServer.util.StringUtil
import java.io.File
class EnvironmentImpl(private val _fileSystemService: FileSystemService) : Environment {
override fun tryGetVariable(... | Make .NET CLI more robust in finding dotnet core installation | Make .NET CLI more robust in finding dotnet core installation
Issue: TW-59135
| Kotlin | apache-2.0 | JetBrains/teamcity-dnx-plugin |
3a966d550f0cac163e45e3866fd832f5bd90b42e | plugins/stats-collector/src/com/intellij/completion/ngram/NGramModelRunnerManager.kt | plugins/stats-collector/src/com/intellij/completion/ngram/NGramModelRunnerManager.kt | // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.completion.ngram
import com.intellij.completion.ngram.slp.modeling.runners.ModelRunner
import com.intellij.lang.Language
import com.intellij.openapi.componen... | // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.completion.ngram
import com.intellij.completion.ngram.slp.modeling.runners.ModelRunner
import com.intellij.lang.Language
import com.intellij.openapi.componen... | Use string instead of Language as map key (to support plugin unloading) | Use string instead of Language as map key (to support plugin unloading)
GitOrigin-RevId: cd8b3540d7bbd7a6b5eeddf5ba33cc247aa58dc3 | Kotlin | apache-2.0 | allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/int... |
338c08d0ee8f3937e9c7388f79f06531f85eb554 | networks/src/main/kotlin/org/walleth/data/networks/all/NetworkDefinition5.kt | networks/src/main/kotlin/org/walleth/data/networks/all/NetworkDefinition5.kt | package org.walleth.data.networks.all
import org.kethereum.model.ChainDefinition
import org.kethereum.model.ChainId
import org.walleth.data.networks.NetworkDefinition
class NetworkDefinition5 : NetworkDefinition {
override val tokenShortName = "GOR"
override val tokenName = "Goerli Ether"
override val ... | package org.walleth.data.networks.all
import org.kethereum.model.ChainDefinition
import org.kethereum.model.ChainId
import org.walleth.data.networks.NetworkDefinition
class NetworkDefinition5 : NetworkDefinition {
override val tokenShortName = "GOR"
override val tokenName = "Goerli Ether"
override val ... | Sort by measurement results from @DaveAppleton | Sort by measurement results from @DaveAppleton
see https://github.com/DaveAppleton/goerli_test
| Kotlin | mit | walleth/kethereum |
84fffd969b52ac6af3484a53ab2f5f2a11d42160 | remote/src/main/java/lt/markmerkk/tickets/JiraProjectStatusesEmitter.kt | remote/src/main/java/lt/markmerkk/tickets/JiraProjectStatusesEmitter.kt | package lt.markmerkk.tickets
import lt.markmerkk.Tags
import lt.markmerkk.entities.TicketStatus
import net.rcarz.jiraclient.JiraClient
import net.rcarz.jiraclient.JiraException
import net.rcarz.jiraclient.Project
import net.rcarz.jiraclient.Status
import org.slf4j.LoggerFactory
import rx.Emitter
import rx.functions.Ac... | package lt.markmerkk.tickets
import lt.markmerkk.Tags
import lt.markmerkk.entities.TicketStatus
import net.rcarz.jiraclient.JiraClient
import net.rcarz.jiraclient.JiraException
import net.rcarz.jiraclient.Project
import net.rcarz.jiraclient.Status
import org.slf4j.LoggerFactory
import rx.Emitter
import rx.functions.Ac... | Fix filter for ticket status | Fix filter for ticket status
| Kotlin | apache-2.0 | marius-m/wt4,marius-m/wt4,marius-m/wt4,marius-m/wt4 |
be6e712e2e25337ff204409dda99faaaee70290f | sqldelight-compiler/src/main/kotlin/app/cash/sqldelight/core/lang/ParserUtil.kt | sqldelight-compiler/src/main/kotlin/app/cash/sqldelight/core/lang/ParserUtil.kt | package app.cash.sqldelight.core.lang
import app.cash.sqldelight.core.SqlDelightProjectService
import app.cash.sqldelight.core.SqldelightParserUtil
import app.cash.sqldelight.core.lang.psi.FunctionExprMixin
import com.alecstrong.sql.psi.core.DialectPreset
import com.alecstrong.sql.psi.core.psi.SqlTypes
import com.inte... | package app.cash.sqldelight.core.lang
import app.cash.sqldelight.core.SqlDelightProjectService
import app.cash.sqldelight.core.SqldelightParserUtil
import app.cash.sqldelight.core.lang.psi.FunctionExprMixin
import com.alecstrong.sql.psi.core.DialectPreset
import com.alecstrong.sql.psi.core.SqlParserUtil
import com.ale... | Reset parser in between tests | Reset parser in between tests
| Kotlin | apache-2.0 | cashapp/sqldelight,cashapp/sqldelight,cashapp/sqldelight,cashapp/sqldelight |
3b2bab8a4632ef54314830edadeca2998827b1b0 | util/src/main/kotlin/io/sweers/catchup/util/SdkVersionsExt.kt | util/src/main/kotlin/io/sweers/catchup/util/SdkVersionsExt.kt | /*
* Copyright (c) 2017 Zac Sweers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed t... | /*
* Copyright (c) 2017 Zac Sweers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed t... | Add OMR1 and sdk() helper | Add OMR1 and sdk() helper
| Kotlin | apache-2.0 | hzsweers/CatchUp,hzsweers/CatchUp,hzsweers/CatchUp,hzsweers/CatchUp |
a169c5071e7e1144a30e3006f437be1973aadce5 | detekt-api/src/main/kotlin/io/gitlab/arturbosch/detekt/api/DetektVisitor.kt | detekt-api/src/main/kotlin/io/gitlab/arturbosch/detekt/api/DetektVisitor.kt | package io.gitlab.arturbosch.detekt.api
import org.jetbrains.kotlin.psi.KtTreeVisitorVoid
/**
* Base visitor for detekt rules.
*
* @author Artur Bosch
*/
open class DetektVisitor : KtTreeVisitorVoid() | package io.gitlab.arturbosch.detekt.api
import com.intellij.psi.PsiElement
import com.intellij.psi.impl.source.tree.LeafPsiElement
import org.jetbrains.kotlin.psi.KtTreeVisitorVoid
/**
* Base visitor for detekt rules.
* Adds additional rules for psi leaf elements.
*
* @author Artur Bosch
*/
@Suppress("EmptyFunct... | Implement visit leaf psi element methods | Implement visit leaf psi element methods
| Kotlin | apache-2.0 | arturbosch/detekt,rock3r/detekt,arturbosch/detekt,Mauin/detekt,arturbosch/detekt,Mauin/detekt,Mauin/detekt,Mauin/detekt,rock3r/detekt,MyDogTom/detekt,rock3r/detekt |
59d0ba466c4b0d52414ac7991b1083e0cd446d19 | src/kotlin/org/intellij/plugins/hcl/Language.kt | src/kotlin/org/intellij/plugins/hcl/Language.kt | /*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... | /*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... | Add hcl language display name | Add hcl language display name
| Kotlin | apache-2.0 | VladRassokhin/intellij-hcl,VladRassokhin/intellij-hcl,VladRassokhin/intellij-hcl,VladRassokhin/intellij-hcl,VladRassokhin/intellij-hcl |
a27cab3feef72a46521e4521b3c2d5666312e731 | android_mobile/src/main/java/com/alexstyl/specialdates/upcoming/UpcomingEventsPresenter.kt | android_mobile/src/main/java/com/alexstyl/specialdates/upcoming/UpcomingEventsPresenter.kt | package com.alexstyl.specialdates.upcoming
import com.alexstyl.specialdates.date.Date
import com.alexstyl.specialdates.date.TimePeriod
import com.alexstyl.specialdates.permissions.ContactPermissionRequest
import io.reactivex.Scheduler
import io.reactivex.disposables.Disposable
import io.reactivex.subjects.PublishSubje... | package com.alexstyl.specialdates.upcoming
import com.alexstyl.specialdates.date.Date
import com.alexstyl.specialdates.date.TimePeriod
import com.alexstyl.specialdates.permissions.ContactPermissionRequest
import io.reactivex.Scheduler
import io.reactivex.disposables.Disposable
import io.reactivex.subjects.PublishSubje... | Move const to companion object | Move const to companion object
| Kotlin | mit | alexstyl/Memento-Namedays,auricgoldfinger/Memento-Namedays,alexstyl/Memento-Calendar,alexstyl/Memento-Calendar,auricgoldfinger/Memento-Namedays,alexstyl/Memento-Calendar,alexstyl/Memento-Namedays |
062d881c1827e8acd688cf10bbbc563dc3bf8d4c | src/main/kotlin/views/ImageView.kt | src/main/kotlin/views/ImageView.kt | package views
import models.Image
import models.Thumbnail
import views.BaseView.baseUrl
import views.BaseView.uriEncode
/**
* Created by allen on 3/30/17.
*/
object ImageView{
fun urlForImageFull(image: Image?): String{
if(image != null){
return "http://photog.alaska.dev/media/images/" + ur... | package views
import models.Image
import models.Thumbnail
import views.BaseView.baseUrl
import views.BaseView.uriEncode
/**
* Created by allen on 3/30/17.
*/
object ImageView{
val ASSET_IMAGE_BASE_URL: String = "http://photog.alaska.dev/media/images/"
val ASSET_THUMBNAIL_BASE_URL: String = "http://photog.a... | Refactor thumbnail and photo asset urls to use constants | Refactor thumbnail and photo asset urls to use constants
| Kotlin | mit | allen-garvey/photog-spark,allen-garvey/photog-spark,allen-garvey/photog-spark |
ca686ab1754855b79e9cc481b206b0109ffbd61d | subprojects/soak/soak.gradle.kts | subprojects/soak/soak.gradle.kts | import org.gradle.gradlebuild.unittestandcompile.ModuleType
plugins {
gradlebuild.classycle
`kotlin-library`
}
dependencies {
testFixturesApi(project(":internalIntegTesting"))
testImplementation(project(":kotlinDslTestFixtures"))
}
gradlebuildJava {
moduleType = ModuleType.INTERNAL
}
testFixture... | import org.gradle.gradlebuild.unittestandcompile.ModuleType
plugins {
gradlebuild.classycle
`kotlin-library`
}
dependencies {
testFixturesApi(project(":internalIntegTesting"))
testImplementation(project(":kotlinDslTestFixtures"))
}
gradlebuildJava {
moduleType = ModuleType.INTERNAL
}
testFixture... | Exclude `META-INF/*.kotlin_module` from `classycle` checks in `soak` | Exclude `META-INF/*.kotlin_module` from `classycle` checks in `soak`
| Kotlin | apache-2.0 | gradle/gradle,gradle/gradle,robinverduijn/gradle,robinverduijn/gradle,gradle/gradle,gradle/gradle,blindpirate/gradle,gradle/gradle,blindpirate/gradle,gradle/gradle,gradle/gradle,robinverduijn/gradle,blindpirate/gradle,robinverduijn/gradle,robinverduijn/gradle,gradle/gradle,gradle/gradle,robinverduijn/gradle,blindpirate... |
252063d822999bbf6fc55b507f3cd5f296897685 | app/src/main/java/info/nightscout/androidaps/utils/buildHelper/BuildHelper.kt | app/src/main/java/info/nightscout/androidaps/utils/buildHelper/BuildHelper.kt | package info.nightscout.androidaps.utils.buildHelper
import info.nightscout.androidaps.BuildConfig
import info.nightscout.androidaps.Config
import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils
import java.io.File
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class BuildHelpe... | package info.nightscout.androidaps.utils.buildHelper
import info.nightscout.androidaps.BuildConfig
import info.nightscout.androidaps.Config
import info.nightscout.androidaps.plugins.general.maintenance.LoggerUtils
import java.io.File
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class BuildHelpe... | Make enginering mode enabled only when turned on | Make enginering mode enabled only when turned on
| Kotlin | agpl-3.0 | jotomo/AndroidAPS,Heiner1/AndroidAPS,jotomo/AndroidAPS,Heiner1/AndroidAPS,Heiner1/AndroidAPS,jotomo/AndroidAPS,Heiner1/AndroidAPS |
e995fc9e3d8d79e241136dad01a91a6ccaf75e07 | spek-junit/src/main/kotlin/API.kt | spek-junit/src/main/kotlin/API.kt | package org.spek.junit.api
import org.spek.impl.*
import org.spek.junit.impl.*
import org.junit.runner.RunWith
import org.junit.Test as test
RunWith(javaClass<SpekJUnitClassRunner<*>>())
public abstract class JUnitSpek: SpekImpl() {
//possible workaround to cheat JUnit integration
test public fun mockTest() ... | package org.spek.junit.api
import org.spek.impl.*
import org.spek.junit.impl.*
import org.junit.runner.RunWith
import org.junit.Test as test
RunWith(javaClass<SpekJUnitClassRunner<*>>())
public abstract class JUnitSpek: SpekImpl() {}
| Update kotlin to correctly report attributes to JUnit integration | Update kotlin to correctly report attributes to JUnit integration
| Kotlin | bsd-3-clause | derkork/spek,paslavsky/spek,JetBrains/spek |
46da9197955776fcf9d7542417f8ceb54cbf6392 | platform/platform-impl/src/com/intellij/ui/NotificationActions.kt | platform/platform-impl/src/com/intellij/ui/NotificationActions.kt | /*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... | /*
* Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... | Rename one of NotificationAction classes to avoid confusion with another | Rename one of NotificationAction classes to avoid confusion with another
| Kotlin | apache-2.0 | mglukhikh/intellij-community,xfournet/intellij-community,FHannes/intellij-community,xfournet/intellij-community,suncycheng/intellij-community,asedunov/intellij-community,ibinti/intellij-community,da1z/intellij-community,allotria/intellij-community,mglukhikh/intellij-community,ThiagoGarciaAlves/intellij-community,signed... |
0c6a1b9ceb31ae658443b552f3afed519d9387f2 | plugins/stats-collector/src/com/intellij/stats/personalization/impl/ProjectUserFactorStorage.kt | plugins/stats-collector/src/com/intellij/stats/personalization/impl/ProjectUserFactorStorage.kt | /*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... | /*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agre... | Save the project factors storage info workspace file | Save the project factors storage info workspace file
| Kotlin | apache-2.0 | allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/intellij-community,allotria/int... |
ffa3052b502969079cdb9fab885842fe5466b0f9 | .teamcity/_Self/Constants.kt | .teamcity/_Self/Constants.kt | package _Self
object Constants {
const val DEFAULT_CHANNEL = "default"
const val EAP_CHANNEL = "eap"
const val DEV_CHANNEL = "Dev"
const val VERSION = "1.10.3"
const val DEV_VERSION = "1.11.0"
const val GITHUB_TESTS = "LATEST-EAP-SNAPSHOT"
const val NVIM_TESTS = "LATEST-EAP-SNAPSHOT"
const val PROPER... | package _Self
object Constants {
const val DEFAULT_CHANNEL = "default"
const val EAP_CHANNEL = "eap"
const val DEV_CHANNEL = "Dev"
const val VERSION = "1.10.3"
const val DEV_VERSION = "1.11.0"
const val GITHUB_TESTS = "LATEST-EAP-SNAPSHOT"
const val NVIM_TESTS = "LATEST-EAP-SNAPSHOT"
const val PROPER... | Update build version of IJ | Update build version of IJ
| Kotlin | mit | JetBrains/ideavim,JetBrains/ideavim |
d5f6686c8dfe4b27c45c7278101bce6c5a3494cb | src/engine/builders/string_builder.rs | src/engine/builders/string_builder.rs | use engine::{Map, Tile};
use engine::builders::{MapBuilder, MapBuildError, MapBuildResult};
use std::iter::{IteratorExt};
pub struct MapFromString {
s: String,
}
impl MapFromString {
pub fn new(s: &str) -> MapFromString {
MapFromString { s: s.to_string() }
}
fn build_line(&self, line: &str)... | use engine::{Map, Tile};
use engine::builders::{MapBuilder, MapBuildError, MapBuildResult};
use std::iter::{IteratorExt};
pub struct MapFromString {
s: String,
}
impl MapFromString {
pub fn new(s: &str) -> MapFromString {
MapFromString { s: s.to_string() }
}
fn build_line(&self, line: &str)... | Remove debug statements in MapFromString | Remove debug statements in MapFromString
| Rust | bsd-3-clause | jgilchrist/rslike |
8daa053af3528f05188e8a42f3c7af21eed3bd06 | src/detail.rs | src/detail.rs | use std::error;
use fat;
pub fn detail_file(args: &[String])
-> Result<(), Box<error::Error>>
{
if args.len() < 2 {
return Err(From::from("expected <file> <image> filename"));
}
let image_fn = args[0].clone();
let image = fat::Image::from(image_fn)?;
let file_metadata = image.get_fil... | use std::error;
use fat;
pub fn detail_file(args: &[String])
-> Result<(), Box<error::Error>>
{
if args.len() < 2 {
return Err(From::from("expected <file> <image> filename"));
}
let image_fn = args[0].clone();
let image = fat::Image::from(image_fn)?;
let file_metadata = image.get_fil... | Tweak number of clusters per line | Tweak number of clusters per line
| Rust | mit | zanesterling/fatr |
2a045cc6c34985a898219e7a2d3e7ba1a411ee7e | src/renderer_server/handlers/export_drawings.rs | src/renderer_server/handlers/export_drawings.rs | use std::path::Path;
use tokio::sync::Mutex;
use crate::ipc_protocol::{
ServerConnection,
ServerResponse,
ExportFormat,
};
use crate::renderer_client::ClientId;
use super::HandlerError;
use super::super::{
access_control::{AccessControl, RequiredData, RequiredTurtles},
renderer::{export, display_... | use std::path::Path;
use tokio::sync::Mutex;
use crate::ipc_protocol::{
ServerConnection,
ServerResponse,
ExportFormat,
};
use crate::renderer_client::ClientId;
use super::HandlerError;
use super::super::{
access_control::{AccessControl, RequiredData, RequiredTurtles},
renderer::{export, display_... | Revert "Locking turtles in export even though they aren't used (guarantees that mutation is impossible)" | Revert "Locking turtles in export even though they aren't used (guarantees that mutation is impossible)"
This reverts commit 61682a533a2de6e92d0e85bb75b95d14bdc0721b.
| Rust | mpl-2.0 | sunjay/turtle,sunjay/turtle,sunjay/turtle |
9e2a86ca81467a4f07a4467848ce53cdbb1da1c0 | src/day7.rs | src/day7.rs | #[macro_use]
extern crate itertools;
use itertools::Itertools;
fn main() {
println!("24 days of Rust - itertools (day 7)");
let mut words = "hello supercalifragilisticexpialidocious programmer".split(|c| c == ' ');
words.foreach(|word| println!("{} is {} characters long", word, word.len()));
let even ... | #[macro_use]
extern crate itertools;
use itertools::Itertools;
fn main() {
println!("24 days of Rust - itertools (day 7)");
let mut words = "hello supercalifragilisticexpialidocious programmer".split(|c| c == ' ');
words.foreach(|word| println!("{} is {} characters long", word, word.len()));
let even ... | Remove `icompr!` macro from day 7. | Remove `icompr!` macro from day 7.
| Rust | mit | zsiciarz/24daysofrust,folkengine/24daysofrust,zsiciarz/24daysofrust,zsiciarz/24daysofrust,folkengine/24daysofrust,folkengine/24daysofrust |
04945fdcd326ec07ad73397064073734a23a1328 | src/main.rs | src/main.rs | fn main() {
println!("Hello, world!");
}
| use std::io::Write;
use std::process::Command;
const FORTUNE: &str = "fortune";
fn main() {
println!("[FORTUNE COOKIE]");
println!("{}", fortune());
}
/// Get a fortune cookie.
fn fortune() -> String {
let output = Command::new(FORTUNE)
.arg("-s") // Short fortunes only
.output()
... | Print fortune using fortune command | Print fortune using fortune command
| Rust | mit | dcoles/experiments,dcoles/experiments,dcoles/experiments,dcoles/experiments |
a3fcb3f9467fbec459d0487e7bc9b0d208b97346 | src/radium_protocol/src/message.rs | src/radium_protocol/src/message.rs | use std::io;
use byteorder::WriteBytesExt;
use super::{MessageType, WriteTo};
use super::messages::{AddEntry, EntryExpired, Entry, RemoveEntry};
pub enum Message {
Ping,
AddEntry(AddEntry),
RemoveEntry(RemoveEntry),
EntryExpired(EntryExpired),
#[doc(hidden)]
__NonExhaustive,
}
impl Message {
... | use std::io;
use byteorder::WriteBytesExt;
use super::{MessageType, WriteTo};
use super::messages::{AddEntry, EntryExpired, RemoveEntry};
pub enum Message {
Ping,
AddEntry(AddEntry),
RemoveEntry(RemoveEntry),
EntryExpired(EntryExpired),
#[doc(hidden)]
__NonExhaustive,
}
impl Message {
pub ... | Move write_to to trait implementation | Move write_to to trait implementation
| Rust | mit | bash/radium,bash/radium,bash/radium |
36c366d9ec082d9063226de06e8ee9b450b18735 | src/main.rs | src/main.rs | use std::io::{self, Write};
fn main() {
println!("Welcome to Chifir!");
println!("");
println!("Type 'help' to get started.");
loop {
print!("> ");
io::stdout().flush().unwrap();
let mut command = String::new();
io::stdin().read_line(&mut command).expect("Failed to re... | mod machine;
use std::io::{self, Write};
fn main() {
println!("Welcome to Chifir!");
println!("");
println!("Type 'help' to get started.");
loop {
print!("> ");
io::stdout().flush().unwrap();
let mut command = String::new();
io::stdin().read_line(&mut command).expect... | Include the "machine" module so the tests run. | Include the "machine" module so the tests run.
| Rust | mit | onefrankguy/chifir |
a1adfa8cb94597fccf485cdcbdbbba79da8ae19b | src/main.rs | src/main.rs | use std::env;
use std::io::prelude::*;
use std::io::BufReader;
use std::collections::HashMap;
use std::path::PathBuf;
use std::fs::File;
static OVERRIDES_PATH : &'static str = ".multirust/overrides";
fn main() {
let home = env::home_dir().expect("Impossible to get your home dir!");
let mut overrides_path = ho... | use std::{env, process};
use std::io::prelude::*;
use std::io::BufReader;
use std::collections::HashMap;
use std::path::PathBuf;
use std::fs::File;
static OVERRIDES_PATH : &'static str = ".multirust/overrides";
fn main() {
let home = env::home_dir().expect("Impossible to get your home dir!");
let mut override... | Handle missing overrides file gracefully | fix: Handle missing overrides file gracefully
| Rust | mit | badboy/rustup-version-name,badboy/rustup-version-name |
3dad80b406697b086e566dfa9af4eca96f9a150d | tests/preserve_order.rs | tests/preserve_order.rs | // Copyright 2017 Serde Developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except accordin... | // Copyright 2017 Serde Developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except accordin... | Remove unnecessary 'static in consts | Remove unnecessary 'static in consts
| Rust | apache-2.0 | google/serde_json_lenient,bolinfest/serde-jsonrc,serde-rs/json |
d7dc9acaadd49bd6b539e03a62bbd2957a9cef8f | src/buffer/gap_buffer.rs | src/buffer/gap_buffer.rs | use super::Position;
use super::Range;
pub struct GapBuffer {
data: String,
}
pub fn new(mut data: String) -> GapBuffer {
// Ensure that the data has enough room to grow without reallocating.
let data_length = data.len();
data.reserve(data_length * 2);
GapBuffer{ data: data }
}
impl GapBuffer {
... | use super::Position;
use super::Range;
pub struct GapBuffer {
data: Vec<u8>,
}
pub fn new(mut data: String) -> GapBuffer {
// Ensure that the data has enough room to grow without reallocating.
let data_length = data.len();
data.reserve(data_length * 2);
GapBuffer{ data: data.into_bytes() }
}
imp... | Store GapBuffer data as a byte vector. | Store GapBuffer data as a byte vector.
| Rust | mit | jmacdonald/scribe |
3b0afd3023a0b449817f30dbd78ea8be73636822 | diesel_compile_tests/tests/compile-fail/must_use_query_methods.rs | diesel_compile_tests/tests/compile-fail/must_use_query_methods.rs | #![deny(unused_must_use)]
#[macro_use]
extern crate diesel;
use diesel::*;
table! {
stuff (b) {
b -> Bool,
}
}
fn main() {
use stuff::table as st;
use stuff::b;
st.select(b); //~ ERROR unused `diesel::query_builder::SelectStatement`
st.select(b).distinct(); //~ ERROR unused `diesel... | #![deny(unused_must_use)]
#[macro_use]
extern crate diesel;
use diesel::*;
table! {
stuff (b) {
b -> Bool,
}
}
fn main() {
use stuff::table as st;
use stuff::b;
st.select(b); //~ ERROR unused `diesel::query_builder::SelectStatement`
st.select(b).distinct(); //~ ERROR unused `diesel... | Add tests for must_use statements | Add tests for must_use statements
| Rust | apache-2.0 | diesel-rs/diesel,sgrif/diesel,diesel-rs/diesel,sgrif/diesel |
378f292be394c055a852f9482cb0a7358a88b741 | tests/simple-test.rs | tests/simple-test.rs | extern crate httpd = "tiny-http";
use std::io::net::tcp::TcpStream;
#[test]
fn basic_handling() {
let (server, port) = httpd::Server::new_with_random_port().unwrap();
let mut stream = std::io::net::tcp::TcpStream::connect("127.0.0.1", port);
write!(stream, "GET / HTTP/1.1\r\nHost: localhost\r\nConnection... | extern crate httpd = "tiny-http";
use std::io::net::tcp::TcpStream;
#[test]
#[ignore]
fn basic_handling() {
let (server, port) = httpd::Server::new_with_random_port().unwrap();
let mut stream = std::io::net::tcp::TcpStream::connect("127.0.0.1", port).unwrap();
write!(stream, "GET / HTTP/1.1\r\nHost: loca... | Test now ignored because of deadlock | Test now ignored because of deadlock
| Rust | apache-2.0 | frewsxcv/tiny-http,bomattin/tiny-http,bomattin/tiny-http,tiny-http/tiny-http,bomattin/tiny-http,frewsxcv/tiny-http |
4e0381c374aed06bb09dabc57c912a7923305316 | src/common.rs | src/common.rs | // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with
// this file, You can obtain one at https://mozilla.org/MPL/2.0/.
pub const NB_CHAR: char = ' '; // non breaking space
pub const NB_CHAR_NARROW: char = '\u{202F}'; // narrow non brea... | // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with
// this file, You can obtain one at https://mozilla.org/MPL/2.0/.
pub const NB_CHAR: char = ' '; // non breaking space
pub const NB_CHAR_NARROW: char = '\u{202F}'; // narrow non brea... | Revert "Remove is_whitespace function as no longer used" since actually STILL used | Revert "Remove is_whitespace function as no longer used" since actually STILL used
This reverts commit 21d02a285521f2dcf3ce2983898fb663c62366c5.
| Rust | mpl-2.0 | lise-henry/crowbook-text-processing |
4533ae53cf76d6533a03153628b5a29439b465a5 | src/lib.rs | src/lib.rs | use std::ops::Add;
pub mod point;
pub mod rect;
pub type Point<T> = point::Point<T>;
pub type Rect<T> = rect::Rect<T>;
trait One<T>
where T: Add<i32, Output=T> +
Default
{
fn one() -> T {
T::default() + 1
}
}
impl<T> One<T> for T
where T: Default + Add<i32, Output=T>
{ /* derive... | use std::ops::Add;
pub mod point;
pub mod rect;
pub type Point<T> = point::Point<T>;
pub type Rect<T> = rect::Rect<T>;
trait One<T> {
fn one() -> T;
}
impl<T> One<T> for T
where T: Add<i32, Output=T> + Default
{
fn one() -> T {
T::default() + 1
}
}
| Change how One trait is implemented | Change how One trait is implemented
| Rust | mit | Vectorious/geom-rs,Vectorious/geom-rs |
d381842d3217707c44129361715e78bbd94c3f8b | src/lib.rs | src/lib.rs | #[test]
fn it_works() {
}
| pub struct HNil;
pub struct HCons<H, T> {
pub head: H,
pub tail: T
}
pub trait Contains<A> {
fn get(&self) -> &A;
fn get_mut(&mut self) -> &mut A;
}
macro_rules! hlist_type_internal {
($hlist_name:ident, $hlist_current:ty, $th:ty, $($tr:ty,)*) => {
hlist_type_internal!($hlist_name, HCons<... | Add code from Gist. Slight modifications to naming, visibility, and use of $crate | Add code from Gist. Slight modifications to naming, visibility, and use of $crate
| Rust | bsd-3-clause | Sgeo/hlist-old |
25d569268f1f3b15ccd0a8532ff9d09a78e5f3e7 | src/api.rs | src/api.rs | extern crate iron;
extern crate rustc_serialize;
use iron::headers::ContentType;
use iron::prelude::*;
use iron::status;
use diesel::prelude::*;
use rustc_serialize::json;
use database;
pub fn index(_: &mut Request) -> IronResult<Response> {
Ok(Response::with((status::Ok, "Welcome to Lugh API!")))
}
pub fn trans... | extern crate iron;
extern crate rustc_serialize;
use iron::headers::ContentType;
use iron::prelude::*;
use iron::status;
use diesel::prelude::*;
use rustc_serialize::json;
use database;
pub fn index(_: &mut Request) -> IronResult<Response> {
Ok(Response::with((status::Ok, "Welcome to Lugh API!")))
}
pub fn trans... | Select last translation inserted for each key/locale pair | Select last translation inserted for each key/locale pair
Naive approach with ids for now.
| Rust | mit | rlustin/lugh,rlustin/lugh,rlustin/lugh |
22ef0369784bab0727b9fc09027aef27dd7eb93d | src/cpu.rs | src/cpu.rs | use vmx;
use collections::vec::Vec;
use core::sync::atomic::{ATOMIC_U16_INIT, AtomicU16, Ordering};
use spin;
static CPU_COUNT: spin::Once<u16> = spin::Once::new();
static CPU_ASSIGNMENT: AtomicU16 = ATOMIC_U16_INIT;
pub fn init(count: u16) {
CPU_COUNT.call_once(||{ count });
}
pub fn bring_core_online() {
... | use vmx;
use collections::vec::Vec;
use core::sync::atomic::{ATOMIC_U16_INIT, AtomicU16, Ordering};
use spin;
static CPU_COUNT: spin::Once<u16> = spin::Once::new();
static CPU_ASSIGNMENT: AtomicU16 = ATOMIC_U16_INIT;
pub fn init(count: u16) {
CPU_COUNT.call_once(||{ count });
}
fn get_cpu_count() -> u16 {
... | Implement Default::default & new for PerCoreVariable | Implement Default::default & new for PerCoreVariable
| Rust | mit | iankronquist/rustyvisor,iankronquist/rustyvisor,iankronquist/rustyvisor |
c56e221540c4df6e33abb3e55bd92ab9f719a37c | src/lib.rs | src/lib.rs | //! # Keyring library
//!
//! Allows for setting and getting passwords on Linux, OSX, and Windows
// Configure for Linux
#[cfg(target_os = "linux")]
extern crate secret_service;
#[cfg(target_os = "linux")]
mod linux;
#[cfg(target_os = "linux")]
pub use linux::Keyring;
// Configure for Windows
#[cfg(target_os = "windo... | //! # Keyring library
//!
//! Allows for setting and getting passwords on Linux, OSX, and Windows
// Configure for Linux
#[cfg(target_os = "linux")]
extern crate secret_service;
#[cfg(target_os = "linux")]
mod linux;
#[cfg(target_os = "linux")]
pub use linux::Keyring;
// Configure for Windows
#[cfg(target_os = "windo... | Add test for empty password | Add test for empty password
Handling empty passwords properly.
I don't have an explicit check for empty passwords in the keyring
library (front-end or any of the backends). Instead, I rely on the
system vaults (or as close as possible to that interface) to report back
errors. I don't want to up-front assume that blan... | Rust | apache-2.0 | hwchen/keyring-rs,hwchen/keyring-rs |
5abc1fb9ff6612ce6804f3f7476626a26239b1f1 | src/phi.rs | src/phi.rs | use value::Value;
use block::BasicBlock;
use ffi::core;
/// A PHI node represents a value which is selected based on the predecessor of the current block.
pub type PhiNode = Value;
impl PhiNode {
/// Adds an incoming value to the end of this PHI node.
pub fn add_incoming(&self, val: &Value, block: &BasicBlock... | use value::Value;
use block::BasicBlock;
use ffi::prelude::LLVMValueRef;
use ffi::core;
use util::CastFrom;
use std::ops::Deref;
use std::{mem, ptr};
/// A PHI node represents a value which is selected based on the predecessor of the current block.
pub struct PhiNode;
native_ref!(&PhiNode = LLVMValueRef);
impl PhiNod... | Make PHI nodes more type safe. | Make PHI nodes more type safe.
| Rust | bsd-3-clause | nwoeanhinnogaehr/llvm-rs |
3a18a7c619ae271b0f0709b591d21ae80987822c | src/radio_tool_button.rs | src/radio_tool_button.rs | use std::ptr;
use RadioToolButton;
use ToolItem;
use ffi;
use glib::object::Downcast;
use glib::translate::*;
impl RadioToolButton {
pub fn new() -> RadioToolButton {
assert_initialized_main_thread!();
unsafe {
ToolItem::from_glib_none(ffi::gtk_radio_tool_button_new(ptr::null_mut())).d... | use std::ptr;
use RadioToolButton;
use ToolItem;
use ffi;
use glib::object::Downcast;
use glib::translate::*;
use glib::Value;
use gobject_ffi;
impl RadioToolButton {
pub fn new() -> RadioToolButton {
assert_initialized_main_thread!();
unsafe {
ToolItem::from_glib_none(ffi::gtk_radio_t... | Add fn join_group to RadioToolButton | Add fn join_group to RadioToolButton
| Rust | mit | rust-gnome/gtk,EPashkin/rust-gnome-gtk,EPashkin/rust-gnome-gtk,rust-gnome/gtk |
a77564a3ff2084a3dc129cc476280050ae1d48d5 | src/net/eth/extractor.rs | src/net/eth/extractor.rs | //! Implementation of Ethernet related Extractors
| //! Implementation of Ethernet related Extractors
use net::Packet;
use net::defs::{Rule, EtherType};
use net::conn::filter::Extractor;
use super::defs::Header;
/// Type responsible for ether type extraction
pub struct EtherTypeExtractor;
impl Extractor<EtherType> for EtherTypeExtractor {
/// Extract the ether... | Add definition of type EtherTypeExtractor | net/eth: Add definition of type EtherTypeExtractor
| Rust | mit | uni-rs/uni.rs |
0ef80e0886941403d4b4014eab4ea636819c6bb9 | code/09/vectors.rs | code/09/vectors.rs | fn main() {
let a_vector = ~[1,2,3];
let mut mut_vector = a_vector;
mut_vector[0] = 5;
println!("The first number is {:d}.", mut_vector[0])
}
| fn main() {
let a_vector = vec![1i, 2i, 3i];
let mut mut_vector = a_vector;
*mut_vector.get_mut(0) = 5;
println!("The first number is {:d}.", mut_vector[0])
}
| Update code sample for chapter 9. | Update code sample for chapter 9.
| Rust | agpl-3.0 | dskecse/rust_for_rubyists,dskecse/rust_for_rubyists,dskecse/rust_for_rubyists,gpbonillas/rust_for_rubyists,steveklabnik/rust_for_rubyists,gpbonillas/rust_for_rubyists,steveklabnik/rust_for_rubyists,steveklabnik/rust_for_rubyists,gpbonillas/rust_for_rubyists |
f5b8c5669bb8c712f1608bc5bc84f8946cce4c6f | liblmdb-sys/build.rs | liblmdb-sys/build.rs | extern crate gcc;
fn main() {
let target = std::env::var("TARGET").unwrap();
let mut config = gcc::Config::new();
config.file("mdb/libraries/liblmdb/mdb.c")
.file("mdb/libraries/liblmdb/midl.c");
if target.contains("dragonfly") {
config.flag("-DMDB_DSYNC=O_SYNC");
config.fla... | extern crate gcc;
fn main() {
let target = std::env::var("TARGET").unwrap();
let mut config = gcc::Config::new();
config.file("mdb/libraries/liblmdb/mdb.c")
.file("mdb/libraries/liblmdb/midl.c");
config.opt_level(2);
if target.contains("dragonfly") {
config.flag("-DMDB_DSYNC=O_S... | Build sys crate with opt-level 2 | Build sys crate with opt-level 2
It looks like by default optimization level for C code was the same as
for Rust, which caused LMDB to be built with -O3 in release mode and
that is not supported officially => sometimes it crashed.
Fixes #40
| Rust | mit | vhbit/lmdb-rs,vhbit/lmdb-rs |
8c1cbd6817241e7f13a985a79a904f1cfac7899e | linkhack.rs | linkhack.rs | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Some crumminess to make sure we link correctly
#[cfg(target_os = "linux")]
#[link(name = "azure")]
#[link(name... | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Some crumminess to make sure we link correctly
#[cfg(target_os = "linux")]
#[link(name = "azure")]
#[link(name... | Update link libraries to ensure that check-servo-net can link skia | Update link libraries to ensure that check-servo-net can link skia
| Rust | mpl-2.0 | mbrubeck/rust-azure,akiss77/rust-azure,hyowon/rust-azure,vvuk/rust-azure,vvuk/rust-azure,akiss77/rust-azure,mrobinson/rust-azure,vvuk/rust-azure,mrobinson/rust-azure,mrobinson/rust-azure,akiss77/rust-azure,servo/rust-azure,nox/rust-azure,dzbarsky/rust-azure,hyowon/rust-azure,servo/rust-azure,hyowon/rust-azure,mmatyas/r... |
f1b67d11f9e092a6686041cce16519793d0c5d25 | tests/sanity.rs | tests/sanity.rs | extern crate pandoc;
use std::path::PathBuf;
#[test]
fn creation() {
use pandoc::PandocOption::*;
use pandoc::OutputKind;
let mut pandoc = pandoc::new();
pandoc.add_input("cake");
pandoc.set_output(OutputKind::File(String::from("lie")));
pandoc.set_chapters();
pandoc.set_number_sections()... | extern crate pandoc;
use std::path::PathBuf;
#[test]
fn creation() {
use pandoc::PandocOption::*;
use pandoc::OutputKind;
let mut pandoc = pandoc::new();
pandoc.add_input("cake");
pandoc.set_output(OutputKind::File(String::from("lie")));
pandoc.set_chapters();
pandoc.set_number_sections()... | Adjust test to new API | Adjust test to new API | Rust | apache-2.0 | oli-obk/rust-pandoc |
47b96d5743d50e49808857d50fd6b142fba904a0 | src/context.rs | src/context.rs | use std::mem;
use super::gl;
use super::gl_lib::types::*;
use super::Buffer;
pub struct Context;
impl Context {
pub unsafe fn current_context() -> Self {
Context
}
pub fn clear_color(&mut self, color: super::Color) {
unsafe {
gl::ClearColor(color.r, color.g, color.b, color.a);... | use std::mem;
use super::gl;
use super::gl_lib::types::*;
use super::{Buffer, ArrayBufferBinder, ElementArrayBufferBinder};
pub struct Context {
array_buffer: ArrayBufferBinder,
element_array_buffer: ElementArrayBufferBinder
}
impl Context {
pub unsafe fn current_context() -> Self {
Context {
... | Add buffer binder fields to `Context` | Add buffer binder fields to `Context`
| Rust | apache-2.0 | kylewlacy/glitter,kylewlacy/glitter |
b1c61dcc0fc331b544aa49495a37f1063d974dd9 | src/post.rs | src/post.rs | use std::collections::HashMap;
#[deriving(PartialEq, Show)]
pub struct Post {
header: HashMap<String, String>,
content: String
}
impl Post {
pub fn new(header: HashMap<String, String>, content: &str) -> Post {
Post { header: header, content: content.to_string() }
}
}
| use std::collections::HashMap;
#[deriving(PartialEq, Show)]
pub struct Post {
header: HashMap<String, String>,
content: String
}
impl Post {
pub fn new(header: HashMap<String, String>, content: &str) -> Post {
Post { header: header, content: content.to_string() }
}
pub fn content(&self) -... | Add method to retrieve content from Post | Add method to retrieve content from Post
| Rust | bsd-3-clause | indiv0/ferrum |
d68259456eaff0bc93c4ad812ce2e7c9bc82e477 | src/engine/world.rs | src/engine/world.rs | use engine::{Actor, Map};
use util::units::{Direction, Point};
use std::path::Path;
pub struct World {
pub player: Actor,
pub actors: Vec<Actor>,
pub map: Map,
}
impl World {
pub fn new() -> World {
World {
player: Actor::new("Player", Point::new(10, 10), 100, '@'),
a... | use engine::{Actor, Map};
use util::units::{Direction, Point};
pub struct World {
pub player: Actor,
pub actors: Vec<Actor>,
pub map: Map,
}
impl World {
pub fn new() -> World {
World {
player: Actor::new("Player", Point::new(10, 10), 100, '@'),
actors: Vec::new(),
... | Remove unnecessary Path::new, and use AsPath overloading instead | Remove unnecessary Path::new, and use AsPath overloading instead
| Rust | bsd-3-clause | jgilchrist/rslike |
5534ed6d76edd478663290a17d4d399e85446d1d | src/main.rs | src/main.rs | fn main() {
println!("Hello, world!");
}
| extern crate clap;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate toml;
mod config;
mod workflow;
use clap::{App, SubCommand};
fn main() {
let _ = workflow::new();
let matches = App::new("jira")
.version(env!("CARGO_PKG_VERSION"))
.about("Alfred JIRA Workflow.")... | Make possible to recevie commands | :sparkles: Make possible to recevie commands
| Rust | mit | dorayakikun/alfred_jira_workflow |
57f7653d7bcb2274a0382c6b7040137ee9f7da04 | src/main.rs | src/main.rs | extern crate rand;
const N: usize = 3;
struct MetricHolder {
// TODO: make N a part of the metric holder and use a vector
// also improve by persisting the sum instead of doing avg every time
history: [u32; N],
counter: usize
}
impl MetricHolder {
fn moving_average(&mut self, new_val: u32) -> f64... | use std::collections::LinkedList;
struct MetricHolder {
n: usize,
sum: u32,
history: LinkedList<u32>
}
impl MetricHolder {
fn moving_average(&mut self, new_val: u32) -> f64 {
self.history.push_back(new_val);
self.sum += new_val;
if self.history.len() > self.n {
let ... | Add MetricHolder::new() and use LinkedList | Add MetricHolder::new() and use LinkedList
| Rust | mit | lyuboraykov/rust-exercises |
c610e4d77216b3fc61980eda46a485cff6dfca44 | src/main.rs | src/main.rs |
extern crate mprovision;
extern crate clap;
use std::fs;
use clap::{Arg, App, AppSettings, SubCommand};
fn main() {
let count_subcommand = SubCommand::with_name("count")
.about("Counts provisioning profiles in a directory.")
.arg(Arg::with_name("DIREC... |
extern crate mprovision;
extern crate clap;
use std::fs;
use clap::{Arg, App, AppSettings, SubCommand};
fn main() {
let subcommands = vec![
SubCommand::with_name("count")
.about("Counts provisioning profiles in a directory.")
.arg(Arg::with_name("DIRECTORY")
.help(... | Use vec of subcommands for future. | Use vec of subcommands for future.
| Rust | mit | zummenix/mprovision |
b96b5f888c060b1afc7b0c0463d3e18d7d01df09 | src/gauge.rs | src/gauge.rs | pub struct Gauge<T> {
pub value: T
}
impl<T> Gauge<T> {
pub fn update(&mut self, value: T) {
self.value = value
}
pub fn snapshot(self) -> Gauge<T> {
Gauge { value: self.value }
}
}
#[cfg(test)]
mod test {
use gauge::Gauge;
#[test]
fn create_and_snapshot() {
... | pub struct StdGauge<T> {
pub value: T
}
pub trait Gauge<T> {
fn update(&mut self, value: T);
fn snapshot(self) -> Self;
}
impl<T> Gauge<T> for StdGauge<T> {
fn update(&mut self, value: T) {
self.value = value
}
fn snapshot(self) -> StdGauge<T> {
StdGauge { value: self.value ... | Use traits and type specifiable | Use traits and type specifiable
| Rust | apache-2.0 | ekarlso/rust-metrics,ekarlso/rust-metrics |
86fbf7e2c23703aa8a74ecfb371644d2f2d63cd3 | src/main.rs | src/main.rs | extern crate iron;
#[macro_use]
extern crate router;
extern crate dotenv;
extern crate sbb_telegram_bot;
use dotenv::dotenv;
use iron::prelude::*;
use sbb_telegram_bot::route;
use sbb_telegram_bot::util::{telegram, twitter};
use std::thread;
use std::time::Duration;
fn main() {
dotenv().ok();
thread::spawn(br... | extern crate iron;
#[macro_use]
extern crate router;
extern crate dotenv;
extern crate sbb_telegram_bot;
use dotenv::dotenv;
use iron::prelude::*;
use sbb_telegram_bot::route;
use sbb_telegram_bot::util::{telegram, twitter};
use std::thread;
use std::time::Duration;
fn main() {
dotenv().ok();
thread::spawn(br... | Set twitter poll back to railinfo | Set twitter poll back to railinfo
| Rust | agpl-3.0 | SirRade/sbb-telegram-bot |
1e9dc2c02a8aa21195d1e487ec389fc7a7f5a5f9 | src/main.rs | src/main.rs | extern crate rand;
use rand::thread_rng;
use rand::distributions::Range;
use individual::Individual;
mod individual;
fn main() {
let mut rng = thread_rng();
let range = Range::new(-512.03_f64, 511.97); // range for Schwefel problem
// initialize population
let mut population: Vec<_> = (0..128).map(|... | extern crate rand;
use rand::{Rng, thread_rng};
use rand::distributions::Range;
use individual::Individual;
mod individual;
fn select<'a, R: Rng>(population: &'a Vec<Individual>, rng: &mut R)
-> &'a Individual {
let population: Vec<_> = (0..4).map(|_| rng.choose(population)).collect();
... | Implement tournament selection to obtain some convergence | Implement tournament selection to obtain some convergence
| Rust | agpl-3.0 | andschwa/rust-genetic-algorithm |
2644dac3de9caa7f4751459c9b8bf731edcbabf6 | _includes/example.rs | _includes/example.rs | // This code is editable and runnable!
fn main() {
// A simple integer calculator:
// `+` or `-` means add or subtract by 1
// `*` or `/` means multiply or divide by 2
let program = "+ + * - /";
let mut accumulator = 0;
for token in program.chars() {
match token {
'+' => ac... | #![feature(core)]
// This code is editable and runnable!
fn main() {
// A simple integer calculator:
// `+` or `-` means add or subtract by 1
// `*` or `/` means multiply or divide by 2
let program = "+ + * - /";
let mut accumulator = 0;
for token in program.chars() {
match token {
... | Fix warning about unstable library features | Fix warning about unstable library features | Rust | apache-2.0 | AndrewBrinker/rust-www,azerupi/rust-www,AndrewBrinker/rust-www,ituxbag/rust-www,AndrewBrinker/rust-www,jFransham/rust-www,starsep/rust-www,starsep/rust-www,azerupi/rust-www,ituxbag/rust-www,ituxbag/rust-www,starsep/rust-www,ituxbag/rust-www,ituxbag/rust-www,ituxbag/rust-www,jFransham/rust-www,azerupi/rust-www,starsep/r... |
c6e9cb5a5ecf89bd93ebc0b6138fef9751030ce9 | fractal-piston/src/main.rs | fractal-piston/src/main.rs | // Copyright (c) 2015-2016 William (B.J.) Snow Orvis
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicab... | // Copyright (c) 2015-2016 William (B.J.) Snow Orvis
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicab... | Remove a now-extraneous `use std` | Remove a now-extraneous `use std`
| Rust | apache-2.0 | aetherknight/fractal-rs,aetherknight/fractal-rs,aetherknight/fractal-rs,aetherknight/fractal-rs |
6c7ca374e41e489aa1c62cd327f0c8acfb34ec0f | src/bin/wav_mirror.rs | src/bin/wav_mirror.rs | //! Reads input from a microphone and mirrors it to a speaker ad nauseum.
extern crate oxcable;
#[cfg(not(test))]
fn main() {
use oxcable::types::Device;
use oxcable::io::wav;
println!("Mirroring wav/song.wav input to wav/test_wav.wav...");
let mut inwav = wav::WavReader::new("wav/song.wav");
let... | //! Reads input from a microphone and mirrors it to a speaker ad nauseum.
extern crate oxcable;
#[cfg(not(test))]
fn main() {
use oxcable::chain::DeviceChain;
use oxcable::io::wav;
println!("Initializing signal chain...");
let inwav = wav::WavReader::new("wav/song.wav");
let samples = inwav.get_n... | Update wav mirror to new api | Update wav mirror to new api
| Rust | apache-2.0 | thenyeguy/oxcable,thenyeguy/oxcable,oxcable/oxcable,oxcable/oxcable |
c48db3d6b3ee61f21969ea090999f5244385c90d | mockall/tests/automock_module_nonpub.rs | mockall/tests/automock_module_nonpub.rs | // vim: tw=80
//! bare functions can use non-public types, as long as the object's visibility is compatible.
// mocking modules requires the proc_macro_hygiene feature in the _consumer_
// code
#![cfg_attr(feature = "nightly", feature(proc_macro_hygiene))]
#[allow(unused)]
cfg_if::cfg_if! {
if #[cfg(feature = "ni... | // vim: tw=80
//! bare functions can use non-public types, as long as the object's visibility is compatible.
// mocking modules requires the proc_macro_hygiene feature in the _consumer_
// code
#![cfg_attr(feature = "nightly", feature(proc_macro_hygiene))]
#[allow(unused)]
cfg_if::cfg_if! {
if #[cfg(feature = "ni... | Fix some unused warnings with the latest rustc compiler | Fix some unused warnings with the latest rustc compiler
| Rust | apache-2.0 | asomers/mockall,asomers/mockall |
b5eb6848a15f9a31a1b2f45e0e6f3995e5f9a5ca | src/utils.rs | src/utils.rs | use std::io;
use std::io::{Read, Write};
use std::fs::File;
pub fn write_file(filename: &str, contents: &Vec<u8>) -> io::Result<()> {
let mut file = try!(File::create(filename));
Ok(try!(file.write_all(contents)))
}
pub fn read_file_to_string(filename: &str, buf: &mut String) -> io::Result<usize> {
let ... | use std::io;
use std::io::{Read, Write};
use std::fs::File;
use std::path::Path;
pub fn write_file<P: AsRef<Path>>(path: P, contents: &Vec<u8>) -> io::Result<()> {
let mut file = try!(File::create(path));
Ok(try!(file.write_all(contents)))
}
pub fn read_file_to_string<P: AsRef<Path>>(path: P, buf: &mut Stri... | Make read_file and write_file take generic paths | Make read_file and write_file take generic paths
| Rust | apache-2.0 | despawnerer/langid-rs |
2ee74d80db764166902ca982300ed71510bb4bd0 | components/core/src/os/system/linux.rs | components/core/src/os/system/linux.rs | use std::{ffi::CStr,
mem};
use libc;
use crate::{error::{Error,
Result},
os::system::Uname};
use errno::errno;
pub fn uname() -> Result<Uname> { unsafe { uname_libc() } }
unsafe fn uname_libc() -> Result<Uname> {
let mut utsname: libc::utsname = mem::uninitialized();
... | use crate::{error::{Error,
Result},
os::system::Uname};
use errno::errno;
use libc;
use std::{ffi::CStr,
mem};
pub fn uname() -> Result<Uname> { unsafe { uname_libc() } }
unsafe fn uname_libc() -> Result<Uname> {
let mut utsname: libc::utsname = mem::MaybeUninit::uninit()... | Fix deprecation warnings with 1.39.0 | Fix deprecation warnings with 1.39.0
Signed-off-by: Josh Black <2831680e59d3b8be5b278b69b4e783c575edf378@gmail.com>
| Rust | apache-2.0 | rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat |
700291f3bf1b2ef0f25facaadf6837d3b17a01ad | scrabble-score/src/lib.rs | scrabble-score/src/lib.rs | fn value(c: char) -> u32 {
match c {
'a' | 'e' | 'i' | 'o' | 'u' | 'l' | 'n' | 'r' | 's' | 't' => 1,
'd' | 'g' => 2,
'b' | 'c' | 'm' | 'p' => 3,
'f' | 'h' | 'v' | 'w' | 'y' => 4,
'k' => 5,
'j' | 'x' => 8,
'q' | 'z' => 10,
_ => 0,
}
}
pub fn score(... | fn value(c: char) -> u32 {
match c {
'a' | 'e' | 'i' | 'o' | 'u' | 'l' | 'n' | 'r' | 's' | 't' => 1,
'd' | 'g' => 2,
'b' | 'c' | 'm' | 'p' => 3,
'f' | 'h' | 'v' | 'w' | 'y' => 4,
'k' => 5,
'j' | 'x' => 8,
'q' | 'z' => 10,
_ => 0,
}
}
pub fn score(... | Improve scrabble by removing unnecessary String::from() | Improve scrabble by removing unnecessary String::from()
| Rust | mit | ragnese/exercism-rust |
99082661372765123989e3bfe4972efc9ee1be75 | examples/input_multiline.rs | examples/input_multiline.rs | use rustyline::validate::MatchingBracketValidator;
use rustyline::{Editor, Result};
use rustyline_derive::{Completer, Helper, Highlighter, Hinter, Validator};
#[derive(Completer, Helper, Highlighter, Hinter, Validator)]
struct InputValidator {
#[rustyline(Validator)]
brackets: MatchingBracketValidator,
}
fn m... | use rustyline::validate::MatchingBracketValidator;
use rustyline::{Cmd, Editor, EventHandler, KeyCode, KeyEvent, Modifiers, Result};
use rustyline_derive::{Completer, Helper, Highlighter, Hinter, Validator};
#[derive(Completer, Helper, Highlighter, Hinter, Validator)]
struct InputValidator {
#[rustyline(Validator)... | Add an example of using newline | Add an example of using newline
| Rust | mit | kkawakam/rustyline |
33eb863c5c3e906a3518c9dc1157411684a0d9d3 | src/platform/wasm/imagelib.rs | src/platform/wasm/imagelib.rs | use std::marker::PhantomData;
#[derive(Copy, Clone)]
pub enum ColorType {
RGBA(u8),
}
pub struct ImageBuffer<T, U = ()>(U, PhantomData<T>);
pub struct Rgba<T>(PhantomData<T>);
pub mod png {
use super::ColorType;
use super::super::png::Encoder;
use std::io::Write;
pub struct PNGEncoder<W>(W);
... | use std::marker::PhantomData;
#[derive(Copy, Clone)]
pub enum ColorType {
RGBA(u8),
}
pub struct ImageBuffer<T, U = ()>(U, PhantomData<T>);
pub struct Rgba<T>(PhantomData<T>);
pub mod png {
use super::ColorType;
use super::super::png::{self as pnglib, HasParameters};
use std::io::Write;
pub struc... | Fix Bug in PNG Encoding | Fix Bug in PNG Encoding
| Rust | apache-2.0 | CryZe/livesplit-core,CryZe/livesplit-core |
d1671c3ff1cc35112be6e78dc767ab54781b9a88 | tcp-throughput/server/src/main.rs | tcp-throughput/server/src/main.rs | use std::env;
use std::io::*;
use std::net::*;
fn main() {
let addr = env::args().nth(1).unwrap_or("127.0.0.1:12345".to_string());
let addr = addr.parse::<SocketAddr>().unwrap();
let l = TcpListener::bind(&addr).unwrap();
println!("listening...");
let b = [0; 64 * 1024];
loop {
let mut ... | use std::env;
use std::io::*;
use std::net::*;
use std::sync::atomic::*;
use std::thread;
use std::time::Duration;
static AMT: AtomicUsize = ATOMIC_USIZE_INIT;
fn main() {
let addr = env::args().nth(1).unwrap_or("127.0.0.1:12345".to_string());
let addr = addr.parse::<SocketAddr>().unwrap();
let l = TcpLis... | Print out connection rates in the server | Print out connection rates in the server
| Rust | mit | aturon/async-benches |
6dc99346413292f85cfe572f3ced29242c36e8e7 | src/test/rustdoc-ui/deprecated-attrs.rs | src/test/rustdoc-ui/deprecated-attrs.rs | // check-pass
#![doc(no_default_passes, passes = "collapse-docs unindent-comments")]
struct SomeStruct;
pub struct OtherStruct;
| // check-pass
#![doc(no_default_passes, passes = "unindent-comments")]
struct SomeStruct;
pub struct OtherStruct;
| Remove deleted pass from rustdoc test suite | Remove deleted pass from rustdoc test suite
`src/test/rustdoc-ui/deprecated-attrs.rs`
tells rustdoc to run the `collapse-docs` pass, which no longer exists
(it was removed in https://github.com/rust-lang/rust/pull/80261).
Rustdoc doesn't actually give a proper diagnostic here; instead it
prints an `error!` log. Now th... | Rust | apache-2.0 | graydon/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust |
7541ae05442ec590268289c840fbf79d2eb53ace | src/utility/macros.rs | src/utility/macros.rs | macro_rules! skip_bytes (
($input: expr, $length: expr, $offset: expr) => (
{
match take!($input, $length) {
IResult::Done(i, bytes) => {
let head = bytes[0] << $offset;
let tail = &bytes[1..];
let is_all_zero = tail.iter().all(|byte| *byte == 0);
... | macro_rules! skip_bytes (
($input: expr, $length: expr, $offset: expr) => (
{
match take!($input, $length) {
$crate::nom::IResult::Done(i, bytes) => {
let head = bytes[0] << $offset;
let tail = &bytes[1..];
let is_all_zero = tail.iter().all(|byte| *byte ... | Use the `$crate` inside `skip_bytes` | Use the `$crate` inside `skip_bytes`
This will allow anyone to use the macro without needing to import
`IResult`, `Err`, or `ErrorCode`.
| Rust | bsd-3-clause | sourrust/flac |
42dfcf71cb9b3575f291e383ae59648363fe76bd | src/selectable/mod.rs | src/selectable/mod.rs | //! Provides drilldown related procedures.
//! This module will be used with `SelectCommand` type by `+` operation
//! to concatinate `select` and `drilldown` queries.
//!
//! Also this module support `pseudo_table` and `staged_columns` manupilation.
pub mod drilldown_type;
pub mod drilldown;
pub mod labeled_drilldown... | //! Provides drilldown related procedures.
//! This module will be used with `SelectCommand` type by `+` operation
//! to concatinate `select` and `drilldown` queries.
//!
//! Also this module support `pseudo_table` and `staged_columns` manupilation.
pub mod drilldown_type;
pub mod drilldown;
pub mod labeled_drilldown... | Add rustdoc for staged columns | Add rustdoc for staged columns
| Rust | mit | cosmo0920/ruroonga_command |
51c6f51c36b95420d9748b0d9d372ccbbaafc93d | test-cargo-miri/src/lib.rs | test-cargo-miri/src/lib.rs | /// Doc-test test
/// ```rust
/// assert!(cargo_miri_test::make_true());
/// ```
pub fn make_true() -> bool {
issue_1705::use_the_dependency();
issue_1691::use_me()
}
| /// Doc-test test
/// ```rust
/// assert!(cargo_miri_test::make_true());
/// ```
pub fn make_true() -> bool {
issue_1567::use_the_dependency();
issue_1705::use_the_dependency();
issue_1691::use_me()
}
| Use the `issue-1567` dependency in the test | Use the `issue-1567` dependency in the test
| Rust | apache-2.0 | rust-lang/miri,rust-lang/miri,rust-lang/miri,rust-lang/miri |
176961258d1a174c75a1bef2990b55c600a94c73 | src/logger.rs | src/logger.rs | extern crate iron;
extern crate time;
use iron::prelude::*;
use iron::{BeforeMiddleware, AfterMiddleware, typemap};
use time::precise_time_ns;
pub struct RequestLogger;
impl typemap::Key for RequestLogger { type Value = u64; }
impl BeforeMiddleware for RequestLogger {
fn before(&self, request: &mut Request) -> ... | extern crate iron;
extern crate time;
use iron::prelude::*;
use iron::{BeforeMiddleware, AfterMiddleware, typemap};
use time::precise_time_ns;
pub struct RequestLogger;
impl typemap::Key for RequestLogger { type Value = u64; }
impl BeforeMiddleware for RequestLogger {
fn before(&self, request: &mut Request) -> ... | Add current time in RequestLogger | Add current time in RequestLogger
| Rust | mit | rlustin/lugh,rlustin/lugh,rlustin/lugh |
73a4c4a76c2724c222fe63ca7b966edd39e743e0 | src/macros.rs | src/macros.rs | #[macro_export]
macro_rules! bson {
([$($val:tt),*]) => {{
let mut array = Vec::new();
$(
array.push(bson!($val));
)*
$crate::Bson::Array(array)
}};
([$val:expr]) => {{
$crate::Bson::Array(vec!(::std::convert::From::from($val)))
}};
({ $($k:exp... | #[macro_export]
macro_rules! bson {
([$($val:tt),*]) => {{
let mut array = Vec::new();
$(
array.push(bson!($val));
)*
$crate::Bson::Array(array)
}};
([$val:expr]) => {{
$crate::Bson::Array(vec!(::std::convert::From::from($val)))
}};
({ $($k:exp... | Remove mut warning for empty macro | Remove mut warning for empty macro
| Rust | mit | zonyitoo/bson-rs,thijsc/bson-rs,kyeah/bson-rs |
d0917a9ae7db1bce84c636a3a4e5c02c44c09af1 | src/fs/linux.rs | src/fs/linux.rs | // Copyright 2020 Google LLC
//
// Use of this source code is governed by an MIT-style license that can be found
// in the LICENSE file or at https://opensource.org/licenses/MIT.
use std::path::Path;
pub fn flags<P>(path: P) -> std::io::Result<u32> where
P: AsRef<Path>
{
let file = std::fs::File::open(path)?;... | // Copyright 2020 Google LLC
//
// Use of this source code is governed by an MIT-style license that can be found
// in the LICENSE file or at https://opensource.org/licenses/MIT.
use std::path::Path;
pub fn flags<P>(path: P) -> std::io::Result<u32> where
P: AsRef<Path>
{
let file = std::fs::File::open(path)?;... | Write tests for the flag collection utility. | Write tests for the flag collection utility.
| Rust | mit | google/rrg |
294bd496c7126c78f99cdffaf1788f4b3cce2669 | src/workflow.rs | src/workflow.rs | extern crate toml;
use config::Config;
pub struct Workflow {
config: Config,
}
pub fn new() -> Workflow {
let config = load_config();
Workflow {
config: config,
}
}
fn load_config() -> Result<Config, String> {
let mut config_file: String = env::home_dir().unwrap();
config_file.push(".... | extern crate toml;
use config::Config;
use std::env;
use std::fs::File;
use std::io::Read;
pub struct Workflow {
config: Config,
}
pub fn new() -> Workflow {
let config = load_config().unwrap();
Workflow {
config: config,
}
}
fn load_config() -> Result<Config, String> {
let mut config_fil... | Make possible to load config file | :sparkles: Make possible to load config file
| Rust | mit | dorayakikun/alfred_jira_workflow |
2809b8f15836eff03877320fd918b47f19c530c8 | src/rust/state_flags.rs | src/rust/state_flags.rs | #[derive(Copy, Clone, PartialEq, Eq)]
pub struct CachedStateFlags(u32);
impl CachedStateFlags {
const MASK_IS_32: u32 = 1 << 0;
const MASK_SS32: u32 = 1 << 1;
const MASK_CPL3: u32 = 1 << 2;
const MASK_FLAT_SEGS: u32 = 1 << 3;
pub const EMPTY: CachedStateFlags = CachedStateFlags(0);
pub fn of_... | #[derive(Copy, Clone, PartialEq, Eq)]
pub struct CachedStateFlags(u8);
impl CachedStateFlags {
const MASK_IS_32: u8 = 1 << 0;
const MASK_SS32: u8 = 1 << 1;
const MASK_CPL3: u8 = 1 << 2;
const MASK_FLAT_SEGS: u8 = 1 << 3;
pub const EMPTY: CachedStateFlags = CachedStateFlags(0);
pub fn of_u32(f... | Make CachedStateFlags u8 to save space in jit_cache_array | Make CachedStateFlags u8 to save space in jit_cache_array
| Rust | bsd-2-clause | copy/v86,copy/v86,copy/v86,copy/v86,copy/v86,copy/v86,copy/v86 |
2d24d4d1ab14f99d72461c2cef52c21dab9d88c9 | src/lib.rs | src/lib.rs | //! An implementation of [FLAC](https://xiph.org/flac), free lossless audio
//! codec, written in Rust.
//!
//! The code is available on [GitHub](https://github.com/sourrust/flac).
//!
//! # Examples
//!
//! Basic decoding from a file.
//!
//! ```
//! use flac::StreamReader;
//! use std::fs::File;
//!
//! match StreamR... | //! An implementation of [FLAC](https://xiph.org/flac), free lossless audio
//! codec, written in Rust.
//!
//! The code is available on [GitHub](https://github.com/sourrust/flac).
//!
//! # Examples
//!
//! Basic decoding from a file.
//!
//! ```
//! use flac::StreamReader;
//! use std::fs::File;
//!
//! match StreamR... | Add documentation for type information of iter | Add documentation for type information of iter
| Rust | bsd-3-clause | sourrust/flac |
bf8cb9108682618e28d5cf69f090780e45d63fa8 | 18_hash_maps/src/main.rs | 18_hash_maps/src/main.rs | use std::collections::HashMap;
fn main() {
let mut scores = HashMap::new();
scores.insert(String::from("Blue"), 10);
scores.insert(String::from("Yellow"), 50);
let teams = vec![String::from("Blue"), String::from("Yellow")];
let initial_scores = vec![10, 50];
let different_scores: HashMap<_, _... | use std::collections::HashMap;
fn main() {
let mut scores = HashMap::new();
scores.insert(String::from("Blue"), 10);
scores.insert(String::from("Yellow"), 50);
let teams = vec![String::from("Blue"), String::from("Yellow")];
let initial_scores = vec![10, 50];
let different_scores: HashMap<_, _... | Add note about using different hashers | Add note about using different hashers
| Rust | mit | pgrzesik/learning-rust |
2ff4f3e46d999e001ebb27da6029bf0e1bacb56d | benches/bench.rs | benches/bench.rs | extern crate dsfmt;
extern crate test;
use test::Bencher;
use std::rand::{Rng, SeedableRng, Isaac64Rng, XorShiftRng};
use dsfmt::DSFMTRng;
#[bench]
fn bench_mt19937_1_000_000_rands(b: &mut Bencher){
let mut rng: DSFMTRng = SeedableRng::from_seed(1);
b.iter(||{
for _ in range(1u, 1_000_000){
... | extern crate dsfmt;
extern crate test;
use test::Bencher;
use std::rand::{Rng, SeedableRng, Isaac64Rng, XorShiftRng};
use dsfmt::DSFMTRng;
#[bench]
fn bench_mt19937_1_000_000_rands(b: &mut Bencher){
let mut rng: DSFMTRng = SeedableRng::from_seed(1);
b.iter(||{
for _ in range(1u, 1_000_000){
... | Add `black_box` calls to avoid f64 generation disappearing. | Add `black_box` calls to avoid f64 generation disappearing.
The final steps of generating an `f64` are fairly pure, and LLVM can see
this, so it just removes it, since the result is unused. The `black_box`
function is designed to manually overcome this, making the benchmarks
more representative.
Before:
test ben... | Rust | bsd-3-clause | Grieverheart/dsfmt-rs |
9bfab47a21c9c5522ded6d60b65e7e22e4f8e6be | src/engine/game.rs | src/engine/game.rs | use engine::World;
pub struct Game {
pub world: World,
}
impl Game {
pub fn new() -> Game {
Game {
world: World::new(),
}
}
pub fn step(&mut self) {
}
}
| use engine::{MessageList, World};
pub struct Game {
pub world: World,
pub log: MessageList,
}
impl Game {
pub fn new() -> Game {
Game {
world: World::new(),
log: MessageList::new(),
}
}
pub fn step(&mut self) {
}
}
| Add a log (MessageList) to the Game | Add a log (MessageList) to the Game
| Rust | bsd-3-clause | jgilchrist/rslike |
1096ab9e1378fa7a4b4dff9b378ed3b8adfc546b | src/convert.rs | src/convert.rs | //! Traits for converting to and from Perl scalars.
use std::fmt::Display;
use raw;
use SV;
/// Fast unsafe conversion from raw SV pointer.
pub trait FromSV {
/// Perform the conversion.
unsafe fn from_sv(pthx: raw::Interpreter, raw: *mut raw::SV) -> Self;
}
/// Construct new `SV` from `self`.
pub trait Into... | //! Traits for converting to and from Perl scalars.
use std::fmt::Display;
use raw;
use SV;
/// Fast unsafe conversion from raw SV pointer.
pub trait FromSV {
/// Perform the conversion.
unsafe fn from_sv(pthx: raw::Interpreter, raw: *mut raw::SV) -> Self;
}
/// Construct new `SV` from `self`.
pub trait Into... | Implement IntoSV for Option<T: IntoSV> | Implement IntoSV for Option<T: IntoSV>
| Rust | bsd-2-clause | vickenty/perl-xs,vickenty/perl-xs |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.