messages listlengths 2 2 | language stringclasses 8
values | prompt_type stringclasses 2
values | lint_errors int64 0 129 ⌀ | cyclomatic_complexity int64 0 32 ⌀ | license stringclasses 7
values | commit stringlengths 40 40 | repos stringlengths 5 116k | new_file stringlengths 4 220 | status stringclasses 6
values | error stringlengths 26 74 ⌀ | is_valid_syntax bool 2
classes |
|---|---|---|---|---|---|---|---|---|---|---|---|
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse cargo_metadata::MetadataCommand;\nuse lazy_static::lazy_static;\nuse std::env;\nuse std::path::PathBuf;\n\nlazy_static! {\n pub static ref CARGO_TARGET_DIR: PathBuf = {\n match env::var_os(\"CARGO_TARGET_DIR\") {\n So... | rust | edit | 2 | 1 | apache-2.0 | c86c09b19a7db3749c2c43a9fa964aa45ac13af1 | aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust | tests/cargo/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse libc;\nuse {Errno, Result};\nuse std::mem;\n\n#[derive(Clone, Copy)]\npub struct UContext {\n context: libc::ucontext_t,\n}\n\nimpl UContext {\n pub fn get() -> Result<UContext> {\n let mut context: libc::ucontext_t = unsafe ... | rust | edit | 5 | 1 | mit | e3e92d74fb62204436f9d02b2c41619393debf0d | xd009642/nix,nikklassen/nix-rust,geofft/nix-rust,carllerche/nix-rust,nikklassen/nix-rust,xd009642/nix,geofft/nix-rust,MarkusJais/nix-rust,Susurrus/nix,nix-rust/nix,kamalmarhubi/nix-rust,nix-rust/nix,kamalmarhubi/nix-rust,MarkusJais/nix-rust,berkowski/nix,xd009642/nix,carllerche/nix-rust,Susurrus/nix,berkowski/nix,posbo... | src/ucontext.rs | rejected_lint | Too many lint violations: 5 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate stripe;\n\nuse std::env;\nuse stripe::{CardParams, Customer, CustomerParams, CustomerSource};\n\nfn main() {\n let secret_key = env::var(\"STRIPE_SECRET_KEY\").expect(\"Missing STRIPE_SECRET_KEY in env\");\n\n // TODO: Keep... | rust | edit | 0 | 1 | apache-2.0 | fb610bcc1060891b89c9ba5096969ceb754b6674 | rapiditynetworks/stripe-rust | examples/create_customer.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! This example shows how to wrap a data structure in a mutex to achieve safe mutability.\n#[macro_use(lazy_static)]\nextern crate lazy_static;\nuse std::collections::HashMap;\nuse std::sync::Mutex;\n\nlazy_static! {\n static ref MUTEX_MA... | rust | edit | 0 | 1 | apache-2.0 | 0fc10cf29f63278b4a64709156726d9ad6e75368 | rust-lang-nursery/lazy-static.rs | examples/mutex_map.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::cmp::Ordering;\n\npub struct JsType {\n uid: u64,\n thing: Box<JsThing>,\n}\n\nimpl PartialEq for JsType {\n fn eq(&self, other: &Self) -> bool {\n self.uid == other.uid\n }\n\n fn ne(&self, other: &Self) -> boo... | rust | edit | 2 | 3 | mit | 71251431ace48aac6c59fc003cd47e7e302e5736 | rustoscript/french-press | src/js_types/js_type.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::old_io::Command;\nuse std::env;\n\nfn main() {\n let curr_dir = Path::new(env::var(\"CARGO_MANIFEST_DIR\").unwrap().into_string().unwrap());\n Command::new(\"git\").arg(\"submodule\").arg(\"update\").arg(\"--init\").cwd(&curr_d... | rust | edit | 0 | 1 | unlicense | e5fb4ef7e74b9d47d472468eea9d28e8a8f6a718 | oakes/neovim-rs | build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse util::units::AsTuple;\n\n#[derive(Copy, Debug, PartialEq)]\npub struct Size {\n pub x: i32,\n pub y: i32\n}\n\nimpl Size {\n\n pub fn new(x: i32, y: i32) -> Size {\n Size { x: x, y: y }\n }\n\n}\n\nimpl AsTuple<i32> for... | rust | edit | 2 | 1 | bsd-3-clause | 47c3ea00514804323bdf00cf28dda74e2918bd93 | jgilchrist/rslike | src/util/units/size.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Netherrack-specific reading I/O operations\n\nuse io_operations::reader::Reader;\n\nextern crate varint;\n\nextern crate bit_utils;\nuse self::bit_utils::BitInformation;\n\npub trait NetherrackReader : Reader {\n\n /// Reads an unsigne... | rust | edit | 0 | 3 | apache-2.0 | 9233068da58cb6f3e833792aa75ccfdcfa851d4d | Techern/Netherrack | src/io/operations/reader.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::collections::BTreeMap;\nuse std::str::FromStr;\n\nuse analysis::functions::Info as FuncInfo;\n\n#[derive(Eq, Debug, Ord, PartialEq, PartialOrd)]\npub enum Type {\n Copy,\n Free,\n Ref,\n Unref,\n}\n\nimpl FromStr for Type... | rust | edit | 0 | 3 | mit | 8d2ed87fc4784cf32e84513c70f686cedf92adb7 | gkoz/gir,gkoz/gir,GuillaumeGomez/gir,EPashkin/gir,GuillaumeGomez/gir,GuillaumeGomez/gir,gtk-rs/gir,gtk-rs/gir,gtk-rs/gir,EPashkin/gir | src/analysis/special_functions.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// ignore-tidy-linelength\n// only-macos\n// no-system-llvm\n// compile-flags: -O\n\n#![crate_type = \"rlib\"]\n#![feature(thread_local)]\n\n// CHECK: @STATIC_VAR_1 = thread_local local_unnamed_addr global <{ [32 x i8] }> zeroinitializer, sec... | rust | edit | 0 | 1 | apache-2.0 | 24abe1646e24caca79cd649f71cd4806a488ee7d | graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust | src/test/codegen/issue-44056-macos-tls-align.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse reference::Reference;\n\npub struct ReferenceCollection {\n pub head: Option<Reference>,\n pub local_references: Vec<Reference>,\n pub remote_references: Vec<Reference>,\n}\n\nimpl ReferenceCollection {\n fn references(&self) ... | rust | edit | 0 | 1 | mit | 942b3ac9e70f7b40b14538973197b8c1f839b77b | kaisellgren/rust_git | src/reference_collection.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse ffi::h5i::hid_t;\nuse ffi::h5p::H5Pclose;\n\nuse object::{Handle, Object};\n\n#[derive(Clone)]\npub struct PropertyList {\n handle: Handle,\n}\n\nimpl Object for PropertyList {\n fn id(&self) -> hid_t {\n self.handle.id()\n ... | rust | edit | 0 | 1 | apache-2.0 | ad64091c9d44be8a8e3f60c070a0870bbe8021c7 | kkirstein/hdf5-rs | src/plist.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::mem;\n\npub struct Any {\n ptr: *mut (),\n // Can't get a real TypeId because we don't have Reflect bounds on the\n // Serializer associates types, so settle for checking size_of and align_of.\n fingerprint: Fingerprint,\... | rust | edit | 0 | 2 | apache-2.0 | 101e0d7cb861e9f6ef4e3834a2a298995da2eb28 | dtolnay/erased-serde | src/any.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2014 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n//... | rust | edit | 0 | 2 | apache-2.0 | 649b20eca9a5d2860eb46f6b9e1d99753d4515b7 | GBGamer/rust,graydon/rust,GBGamer/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,graydon/rust,aidancully/rust,GBGamer/rust,aidancully/rust,aidancully/rust,GBGamer/rust,graydon/rust,graydon/rust,GBGamer/rust,GBGamer/rust | src/test/run-pass/issues/issue-45731.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright (c) The Libra Core Contributors\n// SPDX-License-Identifier: Apache-2.0\n\npub use anyhow::{anyhow, bail, format_err, Error, Result};\nuse libra_types::{transaction::TransactionOutput, vm_error::VMStatus};\nuse thiserror::Error;\... | rust | edit | 0 | 0 | apache-2.0 | 41bce14108d38a3429634b53fca67ef7a68c2ea3 | aptos-labs/aptos-core,libra/libra,libra/libra,libra/libra,aptos-labs/aptos-core,aptos-labs/aptos-core,libra/libra,libra/libra,aptos-labs/aptos-core,aptos-labs/aptos-core,aptos-labs/aptos-core,aptos-labs/aptos-core | language/functional-tests/src/errors.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse config::Config;\n\npub fn check(config: &Config) -> Vec<String> {\n let mut warnings = vec!();\n\n if config.gh_token.is_none() {\n warnings.push(\"The GH_TOKEN environment variable is not configured\".into());\n }\n\n ... | rust | edit | 0 | 4 | mit | 8e248bb47431113616c61bc09b91f10d8ce1e72f | semantic-rs/semantic-rs,semantic-rs/semantic-rs | src/preflight.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\niface foo { fn foo(); }\n\nimpl of foo for uint {}\n\nimpl of foo for uint { fn foo() -> int {} }\n\nimpl of int for uint { fn foo() {} } //~ ERROR interface\n\nfn main() {}\n\n```\n\nApply this change: test: Remove failing parts of the faili... | rust | edit | null | null | apache-2.0 | f3b50ae348306146e342641238c8e21cf0d545bb | aturon/rust,jashank/rust,zachwick/rust,defuz/rust,kwantam/rust,michaelballantyne/rust-gpu,nwin/rust,fabricedesre/rust,aepsil0n/rust,aneeshusa/rust,nwin/rust,stepancheg/rust-ide-rust,jbclements/rust,zubron/rust,XMPPwocky/rust,barosl/rust,carols10cents/rust,LeoTestard/rust,bluss/rand,mihneadb/rust,ktossell/rust,mvdnes/ru... | src/test/compile-fail/iface-test.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(test)]\nextern crate racer_testutils;\nextern crate test;\nuse test::Bencher;\n\nuse racer_testutils::*;\n\n#[bench]\nfn completes_hashmap(b: &mut Bencher) {\n let src = r\"\n use std::collections::HashM~\n\";\n let mut va... | rust | edit | 0 | 2 | mit | 52ad2561db9111a857554c346facf501fe87d18b | phildawes/racer,racer-rust/racer,birkenfeld/racer | benches/bench_stdlibs.rs | rejected_duplicate | Near-duplicate of sample 121206 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmacro_rules! toml_template {\n ($name: expr) => {\n format_args!(\n r##\"\n[package]\nname = \"{0}-fuzz\"\nversion = \"0.0.0\"\nauthors = [\"Automatically generated\"]\npublish = false\nedition = \"2018\"\n\n[package.meta... | rust | edit | 4 | 0 | apache-2.0 | c514eabe5956bceb921b3f1c242726ca31969913 | rust-fuzz/cargo-fuzz | src/templates.rs | rejected_duplicate | Near-duplicate of sample 120829 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse super::*;\n\n#[test]\nfn inner_item_smoke() {\n check_at(\n r#\"\n//- /lib.rs\nstruct inner {}\nfn outer() {\n $0\n fn inner() {}\n}\n\"#,\n expect![[r#\"\n block scope\n inner: v\n ... | rust | edit | 0 | 1 | apache-2.0 | ec4a1dc297eb90dde4c22c682a35606aaa50b4d4 | rust-analyzer/rust-analyzer,rust-analyzer/rust-analyzer,rust-analyzer/rust-analyzer,rust-analyzer/rust-analyzer,rust-analyzer/rust-analyzer | crates/hir_def/src/nameres/tests/block.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse cfg;\nuse std::fmt::Debug;\n\npub trait Lang : Debug + Send + Sync {\n fn eval(&self, code: &str) -> Result<String, String>;\n fn restart(&self) {}\n fn terminate(&self) {}\n}\n\npub fn new(cfg: cfg::LangCfg,\n playpen_... | rust | edit | 3 | 3 | mit | 0ec052feea188784b284fa53c39a2129a42d7cde | angelsl/rs-evalbot,angelsl/rs-evalbot,angelsl/rs-evalbot,angelsl/rs-evalbot,angelsl/rs-evalbot,angelsl/rs-evalbot | evalbot/src/eval/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse protocol::Protocol;\nuse transport::Transport;\nuse Result;\n\npub trait Processor<P: Protocol, T: Transport> {\n fn process(&mut self, prot: &mut P, transport: &mut T) -> Result<()>;\n}\n\n\n```\n\nApply this change: Change Processor:... | rust | edit | 1 | 0 | apache-2.0 | 7f00ea50b34f9ee09b4208b30b82359ddefc3a4d | terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift,terminalcloud/thrift | lib/rs/src/processor.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate radix_trie;\n\nuse radix_trie::Trie;\n\nfn main() {\n let mut t = Trie::new();\n t.insert(\"a\", 5);\n t.insert(\"b\", 6);\n t.insert(\"c\", 50);\n\n let sum = t.child_iter().fold(0, |acc, c| {\n println!(\"... | rust | edit | 0 | 1 | mit | 616acd88153e043c5ee22e47bdaa0b312dda11f0 | michaelsproul/rust_radix_trie,roblabla/rust_radix_trie | examples/child_iter.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nfn main(expr: &str) -> i32 {\n let result = 0;\n for c in expr.chars() {\n match c {\n '0' ... '9' => println!(\"number\"),\n ' ' => println!(\"space\"),\n '+' => println!(\"plus\"),\n _ => panic!(\"unsupported charac... | rust | edit | 0 | 4 | mit | baa4e845343bef037cc4d04db52bc91c38bca4ba | fflorent/rust-rpn | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n\n\n// Elf section headers have a fixed size.\nconst ELF_SECTION_HEADER_SIZE: usize = 56;\n\n#[repr(packed)]\nstruct ElfSymbolTag {\n tag_type: u32,\n size: u32,\n num: u16,\n entsize: u16,\n shndx: u16,\n reserved: u16,\n ... | rust | edit | 0 | 2 | apache-2.0 | 4abe342074bcacf7c9e6433846b07b7533bde6d2 | stallmanifold/rust-multiboot2 | src/elf_symbols.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::env;\nuse std::path::PathBuf;\n\n#[macro_use]\nextern crate log;\n\nmod git;\n\nfn get_current_dir() -> PathBuf {\n env::current_dir().unwrap_or_else(|e| {\n panic!(\"Get current dir expected to succeed. Error: {}\", e);\n ... | rust | edit | 0 | 3 | mit | 9dd0baeb830ee1385fc7897beac62f089b3d79fd | leonardinius/git-wayback-machine.rs,leonardinius/git-wayback-machine.rs | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![crate_id=\"cargo-git-checkout\"]\n\nextern crate cargo;\nextern crate serialize;\nextern crate hammer;\nextern crate url;\n\nuse hammer::FlagConfig;\nuse cargo::{execute_main_without_stdin,CLIResult,CLIError,ToResult};\nuse cargo::sources:... | rust | edit | null | null | apache-2.0 | 46164bc53c7f3c2c5c0717905f82667ae1d3ed23 | erickt/cargo,erickt/cargo | src/bin/cargo-git-checkout.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Endpoints for the media repository.\n\n//! [GET /_matrix/media/r0/download/{serverName}/{mediaId}](https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-media-r0-download-servername-mediaid)\n\nuse ruma_api::ruma_api;\n\nruma_... | rust | edit | 0 | 0 | mit | bb52edf1e0cf0f2232d725af7afb69fb1ebba7e8 | ruma/ruma,ruma/ruma-client-api | src/r0/media/get_content.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub struct Symbol {\n ns: Option<String>,\n name: String,\n}\n\n```\n\nApply this change: Implement Display trait for Symbol struct"
},
{
"role": "assistant",
"content": "use std::fmt;\n\npub struct Symbol {\n ns: Option<... | rust | edit | 0 | 2 | mit | 841254e28e4d599e22bde8185a27454c0dc49ccb | pavel-v-chernykh/lust | src/ast/nodes/symbol.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::path::PathBuf;\nuse std::process::Child;\nuse std::process::Command;\n\npub struct App {\n pub name: String,\n pub port: u16,\n #[allow(dead_code)]\n process: Child,\n}\n\nimpl App {\n pub fn new(name: String, port: u1... | rust | edit | 1 | 1 | mit | 172788883b64196728a0a7d1b6c13d9aaa351ebc | juanibiapina/zas,juanibiapina/zas,juanibiapina/zas | src/http/app.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![allow(non_fmt_panic)]\n\nmacro_rules! assert_const {\n ($len:expr) => {\n assert!($len > 0);\n debug_assert!($len < 0);\n };\n}\n\nfn main() {\n assert!(true);\n assert!(false);\n assert!(true, \"true message\"... | rust | edit | 1 | 2 | apache-2.0 | 38ab1a616631944e8cef21c9441e2ef2ffa3a594 | graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust | tests/ui/assertions_on_constants.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub fn reply(message: &str) -> &str {\n if is_silence(message) { \"Fine. Be that way!\" }\n else if is_yelling(message) { \"Whoa, chill out!\" }\n else if is_question(message) { \"Sure.\" }\n else { \"Whatever.\" }\n}\n\nfn is_sil... | rust | edit | 0 | 4 | mit | 558a7e98cef215c3b75859a08d499264d5fc386c | ekse/exercism-rust,sacherjj/rust,medek/xrust,medek/xrust,spazm/xrust,petertseng/exercism-rust,pminten/xrust,pminten/xrust,ekse/exercism-rust,Rust-Twin-Cities/flaming-octo-wookie,stevejb71/xrust,petertseng/exercism-rust,petertseng/exercism-rust,exercism/xrust,Jeff-Hostetler/xrust,exercism/xrust,spazm/xrust,sacherjj/rust... | bob/example.rs | rejected_duplicate | Near-duplicate of sample 121481 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright:: Copyright (c) 2015-2016 Chef Software, Inc.\n//\n// The terms of the Evaluation Agreement (Habitat) between Chef Software Inc.\n// and the party accessing this file (\"Licensee\") apply to Licensee's use of\n// the Software unt... | rust | edit | 5 | 1 | apache-2.0 | 0117f5d99d58d5f8005a55358e65d99e6473b211 | rsertelon/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat | src/fs.rs | rejected_lint | Too many lint violations: 5 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::fs::File;\nuse std::io::BufReader;\nuse rodio;\nuse rodio::Sink;\nuse game::constants::PISTOL_AUDIO_PATH;\n\npub struct CharacterAudio {\n sink: Sink,\n}\n\nimpl CharacterAudio {\n pub fn new() -> CharacterAudio {\n let endpoint... | rust | edit | 1 | 2 | apache-2.0 | 32740ee0fe320bb929189f500e9cde3d336c1aee | Laastine/zombie-shooter,Laastine/zombie-shooter | src/character/audio.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse super::utils::types::Sha256Digest;\n\npub struct CrosslinkRecord {\n pub epoch: u64,\n pub hash: Sha256Digest\n}\n\nimpl CrosslinkRecord {\n pub fn new(epoch: u64, hash: Sha256Digest) -> CrosslinkRecord {\n CrosslinkRecord... | rust | edit | 2 | 1 | apache-2.0 | 02fd250ddcf79c4467be9940d201235956f17541 | sigp/lighthouse,sigp/lighthouse,sigp/lighthouse,sigp/lighthouse | src/state/crosslink_record.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Various simple lock-free data structures built on `conc`\n\nmod stm;\nmod treiber;\n\npub use self::stm::Stm;\npub use self::treiber::Treiber;\n\n```\n\nApply this change: Add dot to doc comment of `conc::sync`."
},
{
"role": "ass... | rust | edit | 1 | 0 | mit | bfb12399354eeabd3ed2106e858de5fde8e40178 | ticki/tfs,redox-os/tfs | conc/src/sync/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Parse a Rust source file into a `syn::File` and print out a debug\n//! representation of the syntax tree.\n//!\n//! Use the following command from this directory to test this program by\n//! running it on its own source code:\n//!\n//! ... | rust | edit | 0 | 4 | apache-2.0 | 73d052b0a0e1684dab31fc327cc4aba6ed2f32f1 | dtolnay/syn | examples/dump-syntax/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Watchexec: the library\n//!\n//! This is the library version of the CLI tool [watchexec]. The tool is\n//! implemented with this library, but the purpose of the watchexec project is\n//! to deliver the CLI tool, instead of focusing on the... | rust | edit | 4 | 0 | apache-2.0 | 0b5120430cd73059d40145602383cf2a39012030 | mattgreen/watchexec,mattgreen/watchexec,mattgreen/watchexec,mattgreen/watchexec | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub struct Brackets(String);\n\nimpl<'a> From<&'a str> for Brackets {\n fn from(string: &str) -> Self {\n Brackets(string.into())\n }\n}\n\nimpl Brackets {\n pub fn are_balanced(&self) -> bool {\n let mut stack = Vec::n... | rust | edit | 0 | 10 | mit | db7448c316cd4470b6678d1df926573970c6b269 | attilahorvath/exercism-rust | bracket-push/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright:: Copyright (c) 2015-2016 The Habitat Maintainers\n//\n// The terms of the Evaluation Agreement (Habitat) between Chef Software Inc.\n// and the party accessing this file (\"Licensee\") apply to Licensee's use of\n// the Software... | rust | edit | 7 | 1 | apache-2.0 | 8d89ec03e87775048c776a244fd0feeb775b572e | habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat | src/fs.rs | rejected_lint | Too many lint violations: 7 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! SSL client support.\n//!\n//! Which particular library is used depends upon the configuration used at\n//! compile time; at present it can only be OpenSSL (`--cfg openssl`); without\n//! that, you won't be able to use SSL (an attempt to m... | rust | edit | 0 | 0 | apache-2.0 | a9c4f566eaa620b6cec901f2aa8d533613d65983 | Shraddha512/rust-http,Shraddha512/rust-http,servo/rust-http,Shraddha512/rust-http,servo/rust-http,servo/rust-http,servo/rust-http,Shraddha512/rust-http,Shraddha512/rust-http | src/http/client/sslclients/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\npub mod compiler_test;\n\ncompiler_tests! {\n child_references_parent: \"a = 1; { a + 2 }\" => value(3),\n child_references_parent_too_early_error: \"{ a + 2 }; a = 1\" => error(NoSuchField@2),\n // child_references_par... | rust | edit | 0 | 0 | mit | a62bbb520c7b0e1676c8e82428a6e6e0ad026b6b | berg-lang/berg,berg-lang/berg,jkeiser/berg,berg-lang/berg | rust/berg-compiler/tests/scope.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse {Type, Error};\n\nuse std::collections::HashMap;\nuse std::io::prelude::*;\nuse std;\n\npub type SizeType = u32;\n\nimpl<K, V> Type for HashMap<K, V>\n where K: Type + std::hash::Hash + Eq,\n V: Type\n{\n fn read(read: &mut... | rust | edit | 2 | 5 | mit | 6068cd263dc468beb88e312bf372c672fd4c5477 | dylanmckay/protocol,dylanmckay/protocol | src/types/collections/map.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::collections::HashSet;\nuse std::hash::Hash;\n\nfn remove_duplicate_elements_hashing<T: Hash + Eq>(elements: &mut Vec<T>) {\n let set: HashSet<_> = elements.drain(..).collect();\n elements.extend(set.into_iter());\n}\n\nfn remov... | rust | edit | 2 | 1 | unlicense | c5bf7332dee2eee19b5f8098784c6e09cc6188b6 | Hoverbear/rust-rosetta | tasks/remove-duplicate-elements/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse irc::client::prelude::*;\n\nuse plugin::*;\n\nuse error::ErrorKind as FrippyErrorKind;\nuse error::FrippyError;\nuse failure::ResultExt;\n\n#[derive(PluginName, Default, Debug)]\npub struct Help;\n\nimpl Help {\n pub fn new() -> Help {... | rust | edit | 0 | 2 | mit | 8e4b07b759004793e1308ae2f98d18703878e27c | Mavulp/frippy | src/plugins/help.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![no_main]\n\nuse arbitrary::Arbitrary;\nuse libfuzzer_sys::fuzz_target;\n\n#[derive(Arbitrary, Debug)]\nenum IntegerInput {\n I8(i8),\n U8(u8),\n I16(i16),\n U16(u16),\n I32(i32),\n U32(u32),\n I64(i64),\n U64(u64),\... | rust | edit | 0 | 0 | apache-2.0 | ff6798f26eb6debd296442f0b23058306e0aaa19 | dtolnay/itoa | fuzz/fuzz_targets/fuzz_itoa.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[allow(dead_code)]\nfn add_xcode_private_framework_path() {\n // PrivateFramework dir:\n // `xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/PrivateFrameworks/\n let xcode_dir = std::process::Comm... | rust | edit | 3 | 1 | apache-2.0 | dea925018fd63a2fa5fd8dea047dface8c5ef127 | mrmekon/rubrail-rs | build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate gluon;\n\nuse gluon::{new_vm, Compiler};\n\nfn main() {\n let vm = new_vm();\n\n let _ = Compiler::new().run_expr::<&str>(&vm, \"\", r#\" \"test\" \"#);\n //~^ the trait bound `for<'value> &str: gluon::gluon_vm::api::Get... | rust | edit | 0 | 1 | mit | 73294755a09b13a1f7823015534473761a8814b9 | gluon-lang/gluon,Marwes/embed_lang,Marwes/embed_lang,gluon-lang/gluon | tests/compile-fail/run_expr_str_ref.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub fn find_saddle_points(input: &[Vec<u64>]) -> Vec<(usize, usize)> {\n let mut saddle_points = Vec::new();\n\n let width = input.len();\n let height = input[0].len();\n\n for i in 0..width {\n for j in 0..height {\n ... | rust | edit | 0 | 6 | mit | c0db2ce610b839f804e8806fd079ba7f6a286f7d | petertseng/exercism-rust,petertseng/exercism-rust,petertseng/exercism-rust,exercism/xrust,exercism/xrust | exercises/saddle-points/example.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::error::Error;\nuse std::fs::File;\nuse std::io::{Result, Write};\nuse std::path::Path;\n\nuse chunk::*;\n\npub trait SaveToFile {\n fn save_to_file<P: AsRef<Path>>(&mut self, path: P) -> Result<()>;\n}\n\nimpl<I: Iterator<Item=Chu... | rust | edit | 3 | 5 | mit | 76886e39f98b12b754a8ac33f6ae4d933d0b93de | insanebits/gir,GuillaumeGomez/gir,GuillaumeGomez/gir,gtk-rs/gir,GuillaumeGomez/gir,EPashkin/gir,gtk-rs/gir,insanebits/gir,gtk-rs/gir,gkoz/gir,gkoz/gir,EPashkin/gir | src/file_saver.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate termion;\n\nfn main() {\n print!(\"{}{}Stuff\\n\", termion::clear::All, termion::cursor::Goto(1, 1));\n}\n\n```\n\nApply this change: Write something that actually works"
},
{
"role": "assistant",
"content": "exter... | rust | edit | 0 | 3 | mit | b92852ed379620355d20adbc6c4573bae24cfb24 | mathphreak/mfte | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate toml;\nextern crate serde_json;\nuse std::io;\nuse std::io::prelude::*;\n// use serde_json::Value;\n\nfn main() {\n let stdin = io::stdin();\n let mut string = String::new();\n stdin.lock().read_to_string(&mut string).ex... | rust | edit | 0 | 1 | mit | 99eb39d34212b7fe116acc6e5adb0e0b24434817 | rabbit-ci/toml2json | src/bin/json2toml.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// \n// Sysinfo\n// \n// Copyright (c) 2017 Guillaume Gomez\n//\n\n#[cfg(not(target_os = \"windows\"))]\nuse std::fs;\n#[cfg(not(target_os = \"windows\"))]\nuse std::path::{Path, PathBuf};\n#[cfg(not(target_os = \"windows\"))]\nuse libc::{c_c... | rust | edit | 1 | 5 | mit | eb689428eb181ae93ea5c0a4163edaa6e411dac8 | GuillaumeGomez/sysinfo,GuillaumeGomez/sysinfo | src/utils.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(io, net, core, std_misc)]\n\n#[macro_use] extern crate log;\nextern crate hpack;\n\npub mod http;\npub mod client;\n\nmod tests {\n}\n\n```\n\nApply this change: Remove the `net` feature, as it is now stable"
},
{
"role": "... | rust | edit | 2 | 0 | mit | 1f3825b13fa367c088a718ba68cde7c53d449240 | mlalic/solicit,jinnjuice/solicit,gwicke/solicit,stepancheg/solicit,tempbottle/solicit,Galvanization/solicit | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io::File;\nuse serialize::hex::ToHex;\nuse rust_crypto::md5::Md5;\nuse rust_crypto::digest::Digest;\n\n\npub trait DataStore {\n fn write(&self, data: &[u8]) -> ();\n}\n\n\npub struct FileStore{\n path: String,\n}\n\n\nimpl FileSto... | rust | edit | 1 | 3 | mit | c5b286f4c21b655d99549279060dc701b20a6fa6 | jacquesrott/icecore,jacquesrott/icecore | src/data.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate clap;\n\nuse clap::{App, Arg};\n\n/// myprog -f -p=bob -- sloppy slop slop\nfn main() {\n\n let matches = App::new(\"myprog\")\n .arg(Arg::with_name(\"eff\")\n .short(\"f\"))\n .arg(Arg::with_name(\"pe... | rust | edit | 0 | 1 | apache-2.0 | 2c86c8eb4cf3688c75e31332ddbd6942dd62c92b | clap-rs/clap,clap-rs/clap,kbknapp/clap-rs,clap-rs/clap,kbknapp/clap-rs | examples/22_stop_parsing_with_--.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n/*\n * Copyright 2015 Nathan Fiedler\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http:/... | rust | edit | 2 | 0 | apache-2.0 | d1770d87dc68567e8006a9f5158a9bde9af41e03 | nlfiedler/shiranui | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate hyper;\n\nuse std::io::Read;\nuse hyper::Client;\nuse hyper::header::Connection;\n\nstatic WEEKDAY_WEBSITE: &'static str = \"http://www.hvilkenukeerdet.no\";\n\nfn print_help() {\n println!(\"`uke` gives the current week numbe... | rust | edit | 0 | 4 | mit | b0b379febe885aa7c3fc3f061496b87c27cf1b35 | cristeahub/hvilkenukeerdet | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io::Error as IoError;\nuse std::fmt::Display;\nuse serde_json::Error as SerdeError;\nuse clap::Error as ClapError;\nuse tempfile;\nuse atomicwrites;\n\n/// the result type used for the whole application\npub type CtResult<T> = Result... | rust | edit | 3 | 2 | bsd-3-clause | 034a760202f6e530f979d6beca36d7e16b574c26 | dan-t/cpp-typecheck | src/ct_result.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate ghoti;\nextern crate getopts;\n\nuse getopts::Options;\n\nuse std::env;\nuse std::fs::File;\nuse std::path::Path;\n\n\n\nfn print_usage(opts: Options) {\n let usage = \"Usage: ghoti [options] <filename>\";\n print!(\"{}\", ... | rust | edit | 0 | 4 | mit | 8df51e4299b6eeb6b500ef15debe136ec5e04d5a | iKevinY/ghoti.rs | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n\nextern crate ndarray;\nextern crate ndarray_numtest;\n\nuse ndarray::prelude::*;\nuse ndarray_numtest::prelude::*;\n\n#[test]\nfn allclose_success() {\n let a = arr1(&[1.0, 2.0]);\n let b = arr1(&[1.0, 2.0 + 1.0e-9]);\n b.assert_al... | rust | edit | 0 | 1 | mit | 8eed6c62f857e456f5a4979d14904205f7054bde | termoshtt/ndarray-numtest | tests/assert.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse wpilib::wpilib_hal::*;\n\npub fn is_browned_out() -> HalResult<bool> {\n Ok(hal_call!(HAL_GetBrownedOut())? as bool)\n}\n\npub fn is_system_active() -> HalResult<bool> {\n Ok(hal_call!(HAL_GetSystemActive())? as bool)\n}\n\npub fn g... | rust | edit | 0 | 2 | mit | 4fb651a664b8e287c176e304369cfb5307b337ac | KyleStach1678/rust-wpilib,robotrs/rust-wpilib | src/wpilib/robot_state.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::mem::size_of_val;\n\n// This function borrows a slice\nfn analize_slice(slice: &[int]) {\n println!(\"first element of the slice: {}\", slice[0]);\n println!(\"the slice has {} elements\", slice.len());\n}\n\nfn main() {\n /... | rust | edit | null | null | apache-2.0 | 569f6f42306550ac64ca66ba5ecbd025360ae0cd | brunotag/rust-by-example,jinyuanxie/rust-by-example-cn,MatejLach/rust-by-example,rust-lang-cn/rust-by-example-cn,sohan99/rust-by-example,nodakai/rust-by-example,colinvh/rust-by-example,dieface/rust-by-example,mdinger/rust-by-example,youprofit/rust-by-example,zhjh1209/rust-by-example,rwaldron/rust-by-example,nodakai/rus... | src/array/array.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Contains code to handle an IPC channel which is issuing commands.\n\nuse std::io::prelude::*;\n\nuse rustc_serialize::Decodable;\nuse rustc_serialize::json::{Json, ToJson, Decoder, EncoderError};\n\nuse unix_socket::UnixStream;\n\n/// Rea... | rust | edit | null | null | mit | c57422fa6afb3cce79824b41e889e74b20761b23 | way-cooler/way-cooler,Immington-Industries/way-cooler,way-cooler/way-cooler,Immington-Industries/way-cooler,way-cooler/way-cooler,Immington-Industries/way-cooler | src/ipc/channel.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[link(name = \"http\",\n vers = \"0.1-pre\",\n uuid = \"d2ad8df0-547a-4ce1-99c6-a9da3b98fb3e\",\n url = \"\")];\n\n#[comment = \"Rust HTTP server\"];\n#[license = \"MIT/ASL2\"];\n#[crate_type = \"lib\"];\n\n#[deny(non_camel... | rust | edit | null | null | apache-2.0 | 383b0c5f7e0010498b3ca00a4fdc81ed0caa6f53 | servo/rust-http,Shraddha512/rust-http,servo/rust-http,chris-morgan/rust-http,Shraddha512/rust-http,chris-morgan/rust-http,chris-morgan/rust-http,servo/rust-http,servo/rust-http,chris-morgan/rust-http,Shraddha512/rust-http,Shraddha512/rust-http,Shraddha512/rust-http | src/libhttp/lib.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Provides types and functions related to working with SQLite\n//!\n//! Much of this module is re-exported from database agnostic locations.\n//! However, if you are writing code specifically to extend Diesel on\n//! SQLite, you may need to... | rust | edit | 1 | 0 | apache-2.0 | 492d2d9bfcfb495fbe3a29d78a8d8e9b81c9148d | sgrif/diesel,diesel-rs/diesel,sgrif/diesel,diesel-rs/diesel | diesel/src/sqlite/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright lowRISC contributors.\n// Licensed under the Apache License, Version 2.0, see LICENSE for details.\n// SPDX-License-Identifier: Apache-2.0\n\nuse anyhow::Result;\nuse erased_serde::Serialize;\nuse std::any::Any;\nuse std::fs;\nus... | rust | edit | 0 | 5 | apache-2.0 | ca635477fc02ac696f52962a1c80a40ed9099746 | lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan | sw/host/opentitantool/src/command/update_usr_access.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate flac;\nextern crate crypto;\n\nuse crypto::digest::Digest;\nuse crypto::md5::Md5;\nuse flac::Stream;\nuse std::cmp;\n\nfn to_bytes(value: i32, buffer: &mut [u8]) {\n buffer[0] = value as u8;\n buffer[1] = (value >> 8) as u8;\n ... | rust | edit | 0 | 2 | bsd-3-clause | 220923eab13f64cb1915454ab95be2f99c22b29f | sourrust/flac | tests/stream.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse crate::spec::{LinkerFlavor, Target, TargetResult};\n\npub fn target() -> TargetResult {\n let mut base = super::linux_base::opts();\n base.cpu = \"x86-64\".to_string();\n base.max_atomic_width = Some(64);\n base.pre_link_args.... | rust | edit | 0 | 1 | apache-2.0 | 42d652ecd6709b756d95fc42615b166aacd2ea07 | aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust | src/librustc_target/spec/x86_64_unknown_linux_gnux32.rs | rejected_duplicate | Near-duplicate of sample 121502 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate pest;\n\n#[macro_use]\nextern crate pest_derive;\n\n#[macro_use]\nextern crate lazy_static;\n\nextern crate ansi_term;\n\npub mod analysis;\npub mod to_javascript;\npub mod ast;\npub mod error;\npub mod parser;\npub mod compiler;... | rust | edit | 1 | 0 | apache-2.0 | f1f7f3e336d41976e62ab5e48eb7c027f8362c1a | Willifme/robin_core,Willifme/robin_core,Willifme/robin_core | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[feature(macro_rules)];\n\nuse std::io::{file_writer, Create, Truncate};\nuse std::os;\n\npub mod branchify;\npub mod status;\npub mod read_method;\n\nfn main() {\n let args = os::args();\n match args.len() {\n 0 => {\n ... | rust | edit | null | null | apache-2.0 | 330b852af397693b243537e59febcdf6e6c66c4c | Shraddha512/rust-http,chris-morgan/rust-http,chris-morgan/rust-http,servo/rust-http,Shraddha512/rust-http,servo/rust-http,Shraddha512/rust-http,Shraddha512/rust-http,chris-morgan/rust-http,chris-morgan/rust-http,Shraddha512/rust-http,servo/rust-http,servo/rust-http | src/libhttp/codegen/codegen.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2017 Serde Developers\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\n// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\n... | rust | edit | 1 | 1 | apache-2.0 | 5efb22ebee128f1ec4a755556230bdd66c3f2026 | serde-rs/serde | test_suite/no_std/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(rustc_private)]\n#![feature(plugin_registrar, quote)]\nextern crate rustc;\nextern crate syntax;\n\nuse rustc::plugin::Registry;\nuse syntax::ast::TokenTree;\nuse syntax::codemap::Span;\nuse syntax::ext::base::{ExtCtxt, MacEager, M... | rust | edit | 1 | 1 | apache-2.0 | 8782a76e1d164eb4cbf842afeded492e087a4483 | cmr/speculate.rs | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\nmod macros;\n\nuse std::str::FromStr;\n\nuse proc_macro2::{Delimiter, Group, TokenStream, TokenTree};\nuse quote::quote;\nuse std::iter::FromIterator;\nuse syn::{Expr, ExprRange};\n\n#[test]\nfn test_expr_parse() {\n let code... | rust | edit | 2 | 1 | apache-2.0 | c144538e0541f49f4378662cc56ece161126dec3 | dtolnay/syn | tests/test_expr.rs | rejected_duplicate | Near-duplicate of sample 121578 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! A simple utility for getting the size of a terminal. \n//!\n//! Supports both Linux, MacOS, and Windows.\n//!\n//! This crate requires a minimum rust version of 1.31.0 (2018-12-06)\n//!\n//! # Example\n//!\n//! ```\n//! use terminal_siz... | rust | edit | 0 | 1 | apache-2.0 | 65339aa0a3ac967a81401fa08fa9970459a0c8af | eminence/terminal-size | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright:: Copyright (c) 2015-2016 The Habitat Maintainers\n//\n// The terms of the Evaluation Agreement (Habitat) between Chef Software Inc.\n// and the party accessing this file (\"Licensee\") apply to Licensee's use of\n// the Software... | rust | edit | 2 | 0 | apache-2.0 | 6c835311bd3cbdfca8254d7654ec67328bfbf9a5 | habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat,habitat-sh/habitat,habitat-sh/habitat,rsertelon/habitat,habitat-sh/habitat,rsertelon/habitat,rsertelon/habitat | src/url.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! An implementation of [FLAC](https://xiph.org/flac), free lossless audio\n//! codec, written in Rust.\n//!\n//! # Examples\n//!\n//! Basic decoding from a file.\n//!\n//! ```\n//! match flac::Stream::from_file(\"path/to/file.flac\") {\n//!... | rust | edit | 1 | 0 | bsd-3-clause | 8064e3a3ccee9b30b442043a12e1e6b27821395f | sourrust/flac | src/lib.rs | rejected_duplicate | Near-duplicate of sample 120008 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Memory buffer API\n//!\n//! The `Buffer` trait defined here allows the memory buffer of the queue to\n//! be defined independently from the queue implementation.\n\npub mod array;\npub mod dynamic;\n\n/// All buffers must implement this t... | rust | edit | 1 | 2 | mit | 97d42ee6f20bac4e128a2f17ffcc559d54977714 | johnshaw/magnetic | src/buffer/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub trait _StrExt {\n fn _is_char_boundary(&self, index: usize) -> bool;\n}\n\nimpl _StrExt for str {\n #[inline]\n fn _is_char_boundary(&self, index: usize) -> bool {\n if index == self.len() {\n return true;\n ... | rust | edit | 0 | 3 | apache-2.0 | c5c64d48b7d96a0ffc2f8181ccf3a27b0d4f62b8 | clap-rs/clap,clap-rs/clap,clap-rs/clap | src/util/strext.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse nalgebra::na::{AlgebraicVecExt, Rotate, Transform};\nuse bounding_volume::AABB;\nuse geom::Box;\nuse ray::{Ray, RayCast, RayCastWithTransform};\n\nimpl<N: Primitive + Orderable + Algebraic,\n V: AlgebraicVecExt<N> + Clone>\nRayCast<N,... | rust | edit | 0 | 2 | bsd-3-clause | 6b002ccea4b0120dc5eb34c77c15afada915e1cb | sebcrozet/ncollide,MichaelRiss/ncollide,steveklabnik/ncollide,steveklabnik/ncollide,sebcrozet/ncollide,MichaelRiss/ncollide | src/ray/ray_box.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate term;\n\npub fn spinner(rx: Receiver<int>, tx: Sender<int>) {\n let spinner = vec![\"|\", \"/\", \"-\", \"\\\\\",];\n for spin in spinner.iter().cycle() {\n say(\"white\", \"\\x08\");\n say(\"yellow\", *spin);... | rust | edit | 0 | 3 | apache-2.0 | 5f8a33f412feac0323f3fd4407a435e254489e46 | retep998/delivery-cli,chef/delivery-cli,retep998/delivery-cli,retep998/delivery-cli,chef/delivery-cli,chef/delivery-cli,retep998/delivery-cli | src/utils/say.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse super::*;\n\nimpl Editor {\n /// Remove from a given motion (row based), i.e. if the motion given is to another line, all\n /// the lines from the current one to the one defined by the motion are removed. If the motion\n /// defi... | rust | edit | 0 | 7 | mit | 2f98def0f37ef7c41546f81872aaae0a3b815cdc | redox-os/sodium | selection.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nenum Cell {\n Empty,\n Wall,\n Player\n}\n\nfn get_symbol( cell: &Cell ) -> char {\n match cell {\n Empty => '_',\n Wall => '#',\n Player => '@'\n }\n}\n\nfn main() {\n let mut game_field = [ [ Cell::Em... | rust | edit | 5 | 3 | mit | b76ee41ba152923323512fb5d70b8ad8c1089c0e | sborod/pacman-rust | src/main.rs | rejected_lint | Too many lint violations: 5 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![cfg(target_pointer_width = \"64\")]\n\nuse std::mem;\nuse syn::{Expr, Item, Lit, Pat, Type};\n\n#[test]\nfn test_expr_size() {\n assert_eq!(mem::size_of::<Expr>(), 280);\n}\n\n#[test]\nfn test_item_size() {\n assert_eq!(mem::size_of:... | rust | edit | 1 | 1 | apache-2.0 | fa1a855ea02661cf79e7d6af1e60b5a4a08698ac | dtolnay/syn | tests/test_size.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n/// Represent the state of the game as a graph. One node for each cell \n\nuse macroquad::prelude::*;\n\n#[macroquad::main(\"BasicShapes\")]\nasync fn main() {\n loop {\n clear_background(RED);\n\n draw_line(40.0, 40.0, 100.... | rust | edit | 0 | 1 | mit | 86dc04faa4a885f39e664c12c1861c7f4b2270f8 | yzhs/flood-it | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n/* Copyright 2016 Jordan Miner\n *\n * Licensed under the MIT license <LICENSE or\n * http://opensource.org/licenses/MIT>. This file may not be copied,\n * modified, or distributed except according to those terms.\n */\n\n#[macro_use]\nextern... | rust | edit | 0 | 2 | mit | 789acb55b2747f7ba274127c05f8350969ce14e9 | jminer/clear-coat | tests/get_focus_callback.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nstruct Philosopher {\n name: String\n}\n\nimpl Philosopher {\n fn new(name: &str) -> Philosopher {\n Philosopher {\n name: name.to_string()\n }\n }\n\n fn eat(&self) {\n println!(\"{} is done eating... | rust | edit | 0 | 2 | mit | f5caf16b26b48db58249366b983e2f04148f8075 | juliangrosshauser/dining_philosophers | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2014 The HTML5 for Rust Project Developers. See the\n// COPYRIGHT file at the top-level directory of this distribution.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/... | rust | edit | 0 | 3 | apache-2.0 | 7db5926da7cb61ac806d99bd48462f8c98bf744c | aroben/html5ever,aroben/html5ever,Manishearth/html5ever,Manishearth/html5ever,aroben/html5ever,Manishearth/html5ever | test/bin.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![allow(unused)]\n\nmacro_rules! log {\n (target: $target:expr, $lvl:expr, $($arg:tt)+) => {\n let _ = $target;\n let _ = log!($lvl, $($arg)+);\n }\n ($lvl:expr, $($arg:tt)+) => {\n let _ = $lvl;\n let _ ... | rust | edit | 0 | 0 | bsd-3-clause | f91e1a635e5104fc4a113fbb72ad3fe4ca0c1d21 | rust-lang/rust-bindgen,rust-lang/rust-bindgen,rust-lang/rust-bindgen,rust-lang/rust-bindgen | src/log_stubs.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2013 The Servo Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n// http://www.apache.org/licenses/LICENSE-2... | rust | edit | 1 | 0 | apache-2.0 | 513357cae8422a83bc202a28e77ddc43187b3de1 | ruud-v-a/rust-harfbuzz,ruud-v-a/rust-harfbuzz,klutzy/rust-harfbuzz,klutzy/rust-harfbuzz,larsbergstrom/rust-harfbuzz,ruud-v-a/rust-harfbuzz,larsbergstrom/rust-harfbuzz,larsbergstrom/rust-harfbuzz,klutzy/rust-harfbuzz,larsbergstrom/rust-harfbuzz,ruud-v-a/rust-harfbuzz,klutzy/rust-harfbuzz,klutzy/rust-harfbuzz,ruud-v-a/ru... | linkhack.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io::ErrorKind;\nuse std::process::Command;\nuse structopt::StructOpt;\n\nmod commands;\n\n/// Personal CLI.\n#[derive(StructOpt)]\nenum Commands {\n /// Reproduce my computer's configuration.\n Setup,\n\n /// Upgrade what's ... | rust | edit | 0 | 2 | mit | 60158fd6c825954b43db88249f52415f1991b903 | trevordmiller/shell-scripts,trevordmiller/shell-scripts | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2013 The Rust Project Developers. See the COPYRIGHT\n// file at the top-level directory of this distribution and at\n// http://rust-lang.org/COPYRIGHT.\n//\n// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\n//... | rust | edit | null | null | apache-2.0 | 14d721388b1317eb85dd79210c03e303f9ab95aa | emk/rust,aturon/rust,stepancheg/rust-ide-rust,seanrivera/rust,barosl/rust,vhbit/rust,stepancheg/rust-ide-rust,dinfuehr/rust,quornian/rust,kimroen/rust,mihneadb/rust,nwin/rust,gifnksm/rust,stepancheg/rust-ide-rust,P1start/rust,kimroen/rust,servo/rust,robertg/rust,stepancheg/rust-ide-rust,0x73/rust,jbclements/rust,sae-bo... | src/test/run-pass/const-extern-function.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse cargo_test_support::compare::assert_ui;\nuse cargo_test_support::prelude::*;\nuse cargo_test_support::Project;\n\nuse cargo_test_support::curr_dir;\n\n#[cargo_test(requires_rustfmt)]\nfn formats_source() {\n let project = Project::from... | rust | edit | 0 | 2 | apache-2.0 | 15f9c2dc0683adb07cb05a1bf3d4ef0f98603b04 | rust-lang/cargo,nipunn1313/cargo,rustyhorde/cargo,nipunn1313/cargo,eminence/cargo,eminence/cargo,rustyhorde/cargo,rust-lang/cargo,rust-lang/cargo,eminence/cargo,rust-lang/cargo,nipunn1313/cargo,rustyhorde/cargo,eminence/cargo,nipunn1313/cargo,rustyhorde/cargo | tests/testsuite/init/formats_source/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::vec::Vec;\n\nuse engine::{Actor, Map};\nuse engine::builders::MapFromString;\nuse util::units::{Direction, Point};\n\npub struct World {\n pub player: Actor,\n pub actors: Vec<Actor>,\n pub map: Map,\n}\n\nimpl World {\n\n ... | rust | edit | 0 | 2 | bsd-3-clause | 07c82020aee9dba55598419ee5b35c24b03aa538 | jgilchrist/rslike | src/engine/world.rs | rejected_duplicate | Near-duplicate of sample 120891 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate alfred;\n\nuse config::Config;\nuse issue::Issue;\nuse jira_api::SearchIssue;\nuse jira_client;\n\nstruct SearchCommand {\n pub config: Config,\n}\n\nimpl SearchCommand {\n pub fn run(&self, keyword: &String) -> Result<Stri... | rust | edit | 0 | 2 | mit | 06a52cab16e9355fd5619d682dd2770d9ec6ebe2 | dorayakikun/alfred_jira_workflow | src/search_command.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmacro_rules! w {\n ($buf:expr, $to_w:expr) => {\n match $buf.write_all($to_w) {\n Ok(..) => (),\n Err(..) => panic!(\"Failed to write to generated file\"),\n }\n };\n}\n\n#[cfg(feature = \"debug\")]\n... | rust | edit | 2 | 0 | apache-2.0 | bbf6488ede9e990780ea3d29da80ddc813214f00 | clap-rs/clap,clap-rs/clap,clap-rs/clap | clap_complete/src/macros.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub struct StdCounter {\n pub value: i64\n}\n\npub trait Counter {\n fn clear(&mut self);\n fn dec(&mut self, value: i64);\n fn inc(&mut self, value: i64);\n fn snapshot(&self) -> Self;\n}\n\nimpl Counter for StdCounter {\n ... | rust | edit | 0 | 2 | apache-2.0 | 53dae58999f1866cf01d64a0e94b7055756679d7 | ekarlso/rust-metrics,ekarlso/rust-metrics | src/counter.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use] extern crate bitflags;\nextern crate gl as gl_lib;\n#[cfg(feature = \"cgmath\")] extern crate cgmath as cgmath_lib;\n#[cfg(feature = \"image\")] extern crate image as image_lib;\n\nmod ref_into;\n\n#[macro_use] mod macros;\nmod c... | rust | edit | 15 | 0 | apache-2.0 | 0822bf2304bf73be0ec64edef60e1b598a88e462 | kylewlacy/glitter,kylewlacy/glitter | src/lib.rs | rejected_lint | Too many lint violations: 15 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(prelude_import)]\n#![doc = \" Test\"]\n#[prelude_import]\nuse std::prelude::v1::*;\n#[macro_use]\nextern crate std;\n#[doc = \" Test\"]\npub fn test() {}\n\n```\n\nApply this change: Update expected output with normalize_doc_attrib... | rust | edit | 3 | 1 | apache-2.0 | 95bd0211c01da0f912102bcff8ca99ce640236a1 | dtolnay/cargo-expand | tests/lib.expand.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[cfg_attr(target_os = \"emscripten\", ignore)]\n#[rustversion::attr(not(nightly), ignore)]\n#[test]\nfn ui() {\n let t = trybuild::TestCases::new();\n t.compile_fail(\"tests/ui/**/*.rs\");\n}\n\n```\n\nApply this change: Disable ui tes... | rust | edit | 0 | 1 | apache-2.0 | 8a3a6fb1013e9e15bbb085091c4cc65f87d58f5a | serde-rs/serde | test_suite/tests/compiletest.rs | accepted | null | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.