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 env_logger::{Builder, Env};\nuse log::debug;\nuse test_harness::BeaconChainHarness;\nuse types::ChainSpec;\n\n#[test]\nfn it_can_build_on_genesis_block() {\n Builder::from_env(Env::default().default_filter_or(\"trace\")).init();\n\n ... | rust | edit | 0 | 2 | apache-2.0 | dc0696754be06da921b2536af1771f9bdbc9d200 | sigp/lighthouse,sigp/lighthouse,sigp/lighthouse,sigp/lighthouse | beacon_node/beacon_chain/test_harness/tests/chain.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![crate_name = \"bytes\"]\n#![deny(warnings)]\n\npub mod alloc;\nmod buf;\nmod str;\n\npub use buf::{\n Buf,\n BufExt,\n MutBuf,\n MutBufExt,\n ByteBuf,\n MutByteBuf,\n RingBuf,\n ROByteBuf,\n SliceBuf,\n MutSli... | rust | edit | 0 | 0 | mit | 4ce8b1c2c8bfbe9bc6c26dbdfdd4c881beea91be | carllerche/bytes,carllerche/bytes | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nfn main() {\n\tlet subject = \"world\";\n\t\n println!(\"Hello, {}!\", subject);\n println!(\"Goodbye, {}!\", subject);\n}\n\n```\n\nApply this change: Save code after episode is recorded"
},
{
"role": "assistant",
"content"... | rust | edit | 0 | 1 | mit | b7f32273b8b0cb1979e144058d27cb2d1fa1c912 | bits-of-rust/episode-005 | immutabillity/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate protoc_grpcio;\n\nfn main() {\n let proto_root = \"src/\";\n println!(\"cargo:rerun-if-changed={}\", proto_root);\n protoc_grpcio::compile_grpc_protos(&[\"services.proto\"], &[proto_root], &proto_root)\n .expect(\... | rust | edit | 0 | 1 | apache-2.0 | 84a9dbf8e44bd9825eaa4cc6cac18e6e40f8e8f7 | sigp/lighthouse,sigp/lighthouse,sigp/lighthouse,sigp/lighthouse | protos/build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Network interface name resolution.\n//!\n//! Uses Linux and/or POSIX functions to resolve interface names like \"eth0\"\n//! or \"socan1\" into device numbers.\n\nuse libc::{c_uint, if_nametoindex};\nuse std::ffi::{CString, NulError};\nus... | rust | edit | 1 | 4 | mit | d391523c0ec4bda1d3940255f3a52770906371d0 | posborne/rust-nix,nikklassen/nix-rust,geofft/nix-rust,asomers/nix,xd009642/nix,posborne/rust-nix,nikklassen/nix-rust,berkowski/nix,carllerche/nix-rust,geofft/nix-rust,carllerche/nix-rust,nikklassen/nix-rust,nix-rust/nix,berkowski/nix,nix-rust/nix,MarkusJais/nix-rust,berkowski/nix,carllerche/nix-rust,Susurrus/nix,geofft... | src/net/if_.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nfn main() {\n // Assert `Iterator` methods are feature gated\n assert!([1, 2, 2, 9].iter().is_sorted());\n //^ ERROR: use of unstable library feature 'is_sorted'\n assert!(![-2i32, -1, 0, 3].iter().is_sorted_by_key(|n| n.abs()));\... | rust | edit | 0 | 1 | apache-2.0 | b4766f80775a2635c026626070201356f33d2700 | aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust,aidancully/rust,graydon/rust | src/test/ui/feature-gates/feature-gate-is_sorted.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[macro_use]\nextern crate nom;\n\nextern crate ansi_term;\n\npub mod parser;\npub mod ast;\npub mod error;\n\n```\n\nApply this change: Remove old crates and add inline parser module"
},
{
"role": "assistant",
"content": "extern ... | rust | edit | 2 | 0 | apache-2.0 | e59ce64872c30c283289db332a9d284626a96eee | 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#[derive(Debug)]\npub enum Command {\n Output,\n Input,\n Increment,\n Decrement,\n RightShift,\n LeftShift\n}\n\n```\n\nApply this change: Make Command derive Clone trait"
},
{
"role": "assistant",
"content": "#... | rust | edit | 0 | 0 | mit | 9f4dc70c1f36a30e02d1a204bf4d1f74e170775c | nafarlee/thoughtfuck | src/command.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse futures_core::task::{Context, Poll};\nuse futures_io::AsyncRead;\nuse std::io;\nuse std::pin::Pin;\n\n/// Future for the [`take`](super::AsyncReadExt::take) method.\n#[derive(Debug)]\n#[must_use = \"futures do nothing unless you `.await` ... | rust | edit | 0 | 3 | apache-2.0 | 9d29bd67f223d773c4ea27c1cadd9dc32cb087fe | alexcrichton/futures-rs | futures-util/src/io/take.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Cretonne umbrella crate, providing a convenient one-line dependency.\n\n#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]\n#![warn(unused_import_braces, unstable_features)]\n#![cfg_attr(feature = \"clippy\", plugin(clipp... | rust | edit | 2 | 0 | apache-2.0 | 34dc6a1ba568853663d5e0bbecefaff148265c71 | stoklund/cretonne,stoklund/cretonne,stoklund/cretonne | lib/umbrella/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! This module initializes a project.\n\nuse std::{fs, io, error};\n\nuse git2::Repository;\n\n#[derive(Debug)]\npub enum InitError<'a> {\n Io(io::Error),\n FolderNotEmpty(&'a str, usize),\n TodoErr\n}\n\nimpl error::Error for InitE... | rust | edit | 1 | 2 | mit | 7154349695db804f5d6cab439e07386ca2ab49cb | ProtonLights/cli,ProtonLights/proton-cli | src/init/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::result;\nuse std::convert::From;\nuse std::ffi::NulError;\n\n#[derive(Debug, PartialEq)]\npub enum Error {\n InvalidCString(NulError),\n DatabaseError(String),\n}\n\n#[derive(Debug)]\npub enum ConnectionError {\n InvalidCStr... | rust | edit | 3 | 2 | apache-2.0 | 0e12f13e7cc5dc56fa30a55bc5380ee5f025b61d | sgrif/diesel,mcasper/diesel,sgrif/diesel,SoftwareWarlock/diesel,tohou/diesel,cascalheira/diesel,diesel-rs/diesel,mcasper/diesel,SoftwareWarlock/diesel,diesel-rs/diesel,cascalheira/diesel,tohou/diesel | src/result.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// this is just a test binary that can be hooked up to Instruments\nextern crate lonlat_bng;\nuse lonlat_bng::{convert_to_bng_threaded, convert_to_bng_threaded_nocopy, Array};\n\nextern crate rand;\nuse rand::distributions::{IndependentSample... | rust | edit | 0 | 1 | mit | 2d5897bfe7daac00a761693e9b62e0ca642249a8 | urschrei/rust_bng,urschrei/lonlat_bng,urschrei/lonlat_bng,urschrei/lonlat_bng,urschrei/rust_bng | src/bin/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate sdl2;\n\npub use self::screen::Screen;\n\nmod screen;\n\n/// Abstract object that can be created to initialize and access the UI\npub struct UI;\n\nimpl UI {\n\t/// Create an abstract UI object (initializes SDL2 until dropped)\n\... | rust | edit | null | null | mit | 6167b90964d8d89afdcdd27b192ea71205868694 | zargony/rusty64,zargony/rusty64 | src/ui/mod.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse back::machine::MachineCode;\r\nuse middle::ir;\r\n\r\n\r\nstruct InstructionSelector<'a> {\r\n ir: &'a ir::Program,\r\n code: MachineCode\r\n}\r\n\r\nimpl<'a> InstructionSelector<'a> {\r\n fn new(ir: &'a ir::Program) -> Instructi... | rust | edit | 1 | 1 | mit | 9eefda9c43c0780cc28c922f4f2a1b08e8132df9 | msiemens/RusTiny,msiemens/RusTiny | src/back/instsel/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![no_std]\n\n#[macro_use]\nextern crate static_assertions;\n\nassert_impl!(byte; u8, Send, Sync);\n\n#[cfg(feature = \"failure\")]\nassert_impl!(ptr; *const u8, Send, Sync);\n\n#[test]\nfn str_impl() {\n assert_impl!(str, Send, Sync, AsRe... | rust | edit | 0 | 1 | apache-2.0 | f4f23735b213127c829726e2b88c5843e02474c5 | nvzqz/static-assertions-rs | tests/trait_impl.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Define trait for vectors\n\nuse ndarray::{LinalgScalar, Array, Ix1};\nuse num_traits::float::Float;\n\n/// Methods for vectors\npub trait Vector {\n type Scalar;\n /// L-2 norm\n fn norm(&self) -> Self::Scalar;\n}\n\nimpl<A: Floa... | rust | edit | 0 | 3 | mit | 6ac551cd706d6b17a791fdfeb08e0d8a3ed4d00a | termoshtt/ndarray-linalg | src/vector.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! The module describes all possible replies from MPD server.\n//!\n//! Also it contains most generic parser, which can handle\n//! all possible server replies.\n\n\nuse error::{ParseError, ServerError};\nuse std::str::FromStr;\n\n/// All po... | rust | edit | 0 | 5 | apache-2.0 | a1eb0fa03115c642e735d306e131c1fe72a70e48 | kstep/rust-mpd | src/reply.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[derive(PartialEq, Debug)]\npub struct RibonucleicAcid(String);\n\nimpl RibonucleicAcid {\n pub fn new(rna: &str) -> RibonucleicAcid {\n RibonucleicAcid(rna.into())\n }\n}\n\n#[derive(PartialEq, Debug)]\npub struct Deoxyribonucl... | rust | edit | 0 | 2 | mit | 61e797726d39998cbf8877e08903858e212fe4fc | attilahorvath/exercism-rust | rna-transcription/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmod terminal;\n\npub struct Interface {\n choices: Vec<String>\n}\n\nimpl Interface {\n /// Creates a new Interface with the provided input choices.\n pub fn with_choices(choices: Vec<String>) -> Interface {\n Interface {\n ... | rust | edit | 1 | 3 | mit | c0acc44074089194ddcfdca118420967dc03b455 | stewart/rff,stewart/rff | src/interface/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse engine::World;\nuse engine::log;\nuse util::units::Direction;\n\n/// The entire game state.\npub struct Game {\n pub world: World,\n}\n\npub enum Command {\n Walk(Direction),\n}\n\nimpl Game {\n\n /// Creates a new game.\n pub... | rust | edit | 0 | 2 | bsd-3-clause | 2f3e3f206b87c961ff7c735eb3335b8b959f25a8 | jgilchrist/rslike | src/engine/game.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::path::Path;\n\npub trait Command {\n fn call<S>(&self) -> Vec<S>\n where\n S: Into<String>;\n}\n\npub struct Session {\n pub name: String,\n pub window_name: String,\n pub root_path: Path\n}\n\nimpl Command for Se... | rust | edit | 0 | 1 | mit | 94a46b75c960ce83ac36835d80813198976330f8 | brianp/muxed,brianp/muxed | src/load/v2.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmacro_rules! unwrap {\n\t($expr:expr, $fail_body:block) => (\n\t\tmatch $expr {\n\t\t\t::std::option::Option::Some(val) => val,\n\t\t\t::std::option::Option::None => $fail_body\n\t\t}\n\t);\n}\n\nmacro_rules! is_none {\n\t($expr:expr) => (\n\... | rust | edit | 3 | 0 | mit | 382142f35b35f7a371e2c671b9a1ab26c9d5b81a | dubrowgn/tcalc,dubrowgn/tcalc | src/macros.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//\n// SOS: the Stupid Operating System\n// by Hawk Weisman (<EMAIL>)\n//\n// Copyright (c) 2015 Hawk Weisman\n// Released under the terms of the MIT license. See `LICENSE` in the root\n// directory of this repository for more informatio... | rust | edit | 0 | 0 | apache-2.0 | 35984028e008e86d3ed57489b46112e05f2c86e5 | rachlmac/sos-kernel,hawkw/sos-kernel,rachlmac/sos-kernel,hawkw/sos-kernel,rachlmac/sos-kernel,hawkw/sos-kernel | src/arch/x86/cpu.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nmacro_rules! hide_from_rustfmt {\n ($($tt:tt)*) => {\n $($tt)*\n };\n}\n\n#[cfg(not(all(\n feature = \"derive\",\n feature = \"full\",\n feature = \"parsing\",\n feature = \"printing\",\n feature = \"visit\",\n ... | rust | edit | 0 | 0 | apache-2.0 | b3687c02905ecb3eda12f1763e28d2d9e6763139 | dtolnay/syn | tests/features/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! TCP/UDP bindings for `tokio-core`\n//!\n//! This module contains the TCP/UDP networking types, similar to the standard\n//! library, which can be used to implement networking protocols.\n\nmod tcp;\nmod udp;\n\npub use self::tcp::{TcpStre... | rust | edit | 1 | 0 | mit | 7f96b7e9e4859832e848edac658ff42ca73b7ad7 | tokio-rs/tokio,tokio-rs/tokio | src/net/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse types::{self, NativeSqlType};\n\npub trait SqlOrd {}\n\nimpl SqlOrd for types::SmallInt {}\nimpl SqlOrd for types::Integer {}\nimpl SqlOrd for types::BigInt {}\nimpl SqlOrd for types::Float {}\nimpl SqlOrd for types::Double {}\nimpl SqlOr... | rust | edit | 0 | 0 | apache-2.0 | eece68b15d01f1e1ef53605bacaa58da80da7288 | mcasper/diesel,SoftwareWarlock/diesel,diesel-rs/diesel,tohou/diesel,diesel-rs/diesel,sgrif/diesel,cascalheira/diesel,mcasper/diesel,tohou/diesel,sgrif/diesel,cascalheira/diesel,SoftwareWarlock/diesel | yaqb/src/types/ord.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::io::{self, Write};\nuse std::panic::{self, AssertUnwindSafe};\nuse std::process;\n\npub fn catch_unwind<F, R>(label: &'static str, foreign_call: F) -> R\nwhere\n F: FnOnce() -> R,\n{\n // Regarding the AssertUnwindSafe: we imme... | rust | edit | 0 | 3 | apache-2.0 | 57a1eaa5f1ba580936a1b85fc11220def0f461dd | dtolnay/cxx,dtolnay/cxx,dtolnay/cxx,dtolnay/cxx | src/unwind.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::ops::{Mul,Add};\n\npub struct Vec3<T: Mul<T, Output = T> + Add<T, Output = T> + Copy + Clone> {\n x: T,\n y: T,\n z: T,\n}\n\nimpl <T: Mul<T, Output = T> + Add<T, Output = T> + Copy + Clone> Vec3<T> {\n pub fn norm(self) ... | rust | edit | 1 | 1 | mit | 4e85d198ac72408bd65be795ff55cc0be43bbec7 | Chair-of-Indefinite-Studies/scratchapixel | scratchapixel/src/geometry/vector.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n/// Route53 TXT entries require quotations around their values.\n/// Use this function to add quotes if needed. These examples show how\n/// this adds quotes if needed:\n/// ```ignore\n/// let rr = vec![\n/// ResourceRecord {\n/// value... | rust | edit | 0 | 3 | mit | 532a6686025784f6ab54b83f18b841279788dee3 | DualSpark/rust-aws,DualSpark/rusoto,DualSpark/rusoto,rusoto/rusoto,rusoto/rusoto,DualSpark/rust-aws,DualSpark/rust-aws,DualSpark/rusoto,rusoto/rusoto | rusoto/services/route53/src/custom/util.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2016 lazy-static.rs Developers\n//\n// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or\n// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or\n// http://opensource.org/licenses/MIT>, at ... | rust | edit | 2 | 4 | apache-2.0 | 1a18c659f86cc6d2d2b69052891fc563f6904a3f | Kimundi/lazy-static.rs,rust-lang-nursery/lazy-static.rs | src/inline_lazy.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[test]\n#[cfg(feature = \"syntax-highlight\")]\nfn cli_tests() {\n trycmd::TestCases::new().case(\"tests/cmd/*.md\");\n}\n\n```\n\nApply this change: test: Increase CLI test coverage under different feature sets"
},
{
"role": "ass... | rust | edit | 0 | 1 | mit | 3d44328314890e4e88315c91b582297bb73b2d6f | cobalt-org/cobalt.rs,cobalt-org/cobalt.rs,cobalt-org/cobalt.rs,cobalt-org/cobalt.rs | tests/cli_tests.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse frame::ChannelAssignment;\n\npub fn decode(channel_assignment: ChannelAssignment, buffer: &mut [i32]) {\n match channel_assignment {\n ChannelAssignment::Independent => return,\n ChannelAssignment::LeftSide => unimplemented!(),\... | rust | edit | 0 | 2 | bsd-3-clause | 1a0e2e1056eb8bccd50f7c7e07b58cb3e4e0ef53 | sourrust/flac | src/frame/decoder.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse syntax;\nuse syntax::codemap::DUMMY_SP;\nuse syntax::ext::base::{ ExtCtxt, DummyMacroLoader };\n\n/// Create a fake ExtCtxt to perform macro quasiquotes outside of rustc plugins\npub fn with_fake_extctxt<T, F: Fn(&ExtCtxt) -> T>(f: F) -> ... | rust | edit | 1 | 1 | mit | 5ad5fd3b8f57976050f3f1a94d9c63bd94d6f9cd | tempbottle/rust-peg,tempbottle/rust-peg,kevinmehall/rust-peg,kevinmehall/rust-peg | src/fake_extctxt.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Hound -- A wav encoding and decoding library in Rust\n// Copyright (C) 2017 Ruud van Asseldonk\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... | rust | edit | 0 | 4 | apache-2.0 | ff6709a7ad156826964d65e87e31e43c4b192a22 | ruud-v-a/hound,ruuda/hound | fuzz/fuzzers/decode_full.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nfn main() {\n let s = String::from(\"Hello there\");\n\n let first = first_word(&s);\n println!(\"First word is: {}\", first);\n}\n\nfn first_word(s: &String) -> &str {\n let bytes = s.as_bytes();\n\n for (i, &item) in bytes.it... | rust | edit | 2 | 3 | mit | c4fb0a80df8c8dd6500aba7667a557d41e0a6a9f | pgrzesik/learning-rust | slices/src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::env;\nuse std::process::Command;\nuse std::str;\n\n// The rustc-cfg strings below are *not* public API. Please let us know by\n// opening a GitHub issue if your build environment requires some way to enable\n// these cfgs other than ... | rust | edit | 0 | 6 | apache-2.0 | 9add5812e219b86b1ad422876a00d8922a1dc618 | serde-rs/serde | serde_test/build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Todo: Add tile metadata\n\n// use models::*;\nuse core::{Vec2};\n\nstruct Entity;\nstruct Player;\n\n/// The tiles\npub enum Tile {\n Water,\n Grass,\n Tree,\n None,\n}\n\n/// A block: a field consisting of three layers, containing til... | rust | edit | 3 | 1 | mit | b246b1c40dbe9a311e35acc1591bfaee3f1afe1b | Ticki/Open-Sea | src/core/map.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(custom_attribute, custom_derive, plugin)]\n#![plugin(serde_macros)]\n\nextern crate serde;\n\n#[derive(Serialize)]\n#[serde(abc=\"xyz\")] //~ unknown serde container attribute `abc = \"xyz\"`\nstruct Foo {\n x: u32,\n}\n\n#[deri... | rust | edit | 0 | 1 | apache-2.0 | 554b81d636adbfff787e71e1b2e66f565d636bed | oli-obk/rust-serde,serde-rs/serde,erickt/serde | serde_macros/tests/compile-fail/reject-unknown-attributes.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nstruct Counter {\n count: u32\n}\n\nimpl Counter {\n fn new() -> Counter {\n Counter { count: 0 }\n }\n}\n\nimpl Iterator for Counter {\n type Item = u32;\n\n fn next(&mut self) -> Option<Self::Item> {\n self.coun... | rust | edit | 0 | 2 | mit | 502fd29bd91cdee6b03ea548f012db9a0163b62c | pgrzesik/learning-rust | 24_iterators/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nconst MAX_TOP_SCORE_ITEMS: usize = 3;\n\n#[derive(Debug)]\npub struct HighScores<'a> {\n record: &'a [u32],\n}\n\nimpl<'a> HighScores<'a> {\n pub fn new(scores: &'a [u32]) -> Self {\n HighScores { record: scores }\n }\n\n p... | rust | edit | 0 | 5 | bsd-2-clause | ed923cfc1747bf171e0d8b7c7a1f28c60943bb32 | gyn/exercism,gyn/exercism,gyn/exercism,gyn/exercism | rust/high-scores/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nfn main() {\n manage_docs();\n}\n\n#[cfg(any(feature = \"embed-lgpl-docs\", feature = \"purge-lgpl-docs\"))]\nfn manage_docs() {\n extern crate lgpl_docs;\n const PATH: &'static str = \"src\";\n const IGNORES: &'static [&'static s... | rust | edit | 0 | 2 | mit | c51b7e13f5b24b814694350e6b45e580161108af | rust-gnome/cairo | build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse crate::mem::{size_of, transmute_copy};\nuse crate::ptr::write_bytes;\n\npub(super) trait SpecFill<T> {\n fn spec_fill(&mut self, value: T);\n}\n\nimpl<T: Clone> SpecFill<T> for [T] {\n default fn spec_fill(&mut self, value: T) {\n ... | rust | edit | 0 | 3 | apache-2.0 | 38383017d6bf22ded0af1875e164f0f154285f2f | aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,aidancully/rust | library/core/src/slice/specialize.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! The film module provides color types and a render target that the image\n//! is written too. Functions are also provided for saving PPM images\n//! while I wait to migrate over to the Piston image library due to some\n//! compile issues T... | rust | edit | 1 | 4 | mit | 37ddfca5826522f8d7e808299037db6fa202af69 | voidException/tray_rust,Twinklebear/tray_rust,GuzTech/tray_rust | src/film/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n\nuse ::c;\nuse std::str;\nuse std::ffi::{CStr};\n\npub struct XmpString {\n ptr: *mut c::XmpString\n}\n\nimpl XmpString {\n pub fn new() -> XmpString {\n XmpString { ptr: unsafe { c::xmp_string_new() } }\n }\n\n pub fn is_... | rust | edit | 0 | 2 | bsd-2-clause | 4f7f4b8023325efeb76ac3172c349fc47d7cf84b | hfiguiere/exempi-rs | src/xmpstring.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![allow(unstable)]\n\nuse std::io::{self, fs};\nuse std::io::process::{Command, InheritFd};\nuse std::os;\n\nfn run(cmd: &mut Command) {\n println!(\"running: {}\", cmd);\n assert!(cmd.stdout(InheritFd(1))\n .stderr(InheritF... | rust | edit | 1 | 1 | mit | 26c3af2ff910c6d6ec8fb659e88c7a6611a9130e | vhbit/sherwood,vhbit/sherwood | libforestdb-sys/src/build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate cc;\n\nfn main() {\n cc::Build::new()\n .file(\"libmikktspace/mikktspace.c\")\n .file(\"libmikktspace/mikktspace.c\")\n .compile(\"mikktspace\");\n println!(\"cargo:rustc-link-lib=static=mikktspace\");\... | rust | edit | 0 | 1 | apache-2.0 | b3ae27e22eeecfd4bd5bf7739b94789d56c9854a | gltf-rs/mikktspace | build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::iter::FromIterator;\n\n#[derive(PartialEq, Debug)]\npub struct RibonucleicAcid(String);\n\nimpl RibonucleicAcid {\n pub fn new(rna: &str) -> RibonucleicAcid {\n RibonucleicAcid(rna.into())\n }\n}\n\nimpl FromIterator<cha... | rust | edit | 0 | 2 | mit | 06d276d1447efcc9329140a6cc2cea9fe2b8453a | attilahorvath/exercism-rust | rna-transcription/src/lib.rs | rejected_duplicate | Near-duplicate of sample 119799 | 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 | 1 | apache-2.0 | d007d44dad08aa4239a2e85ce00a0466f32a4440 | andars/rust,l0kod/rust,0x73/rust,zubron/rust,mvdnes/rust,hauleth/rust,reem/rust,gifnksm/rust,XMPPwocky/rust,kwantam/rust,jashank/rust,jashank/rust,bombless/rust,victorvde/rust,mihneadb/rust,mdinger/rust,carols10cents/rust,aepsil0n/rust,aneeshusa/rust,gifnksm/rust,rprichard/rust,barosl/rust,AerialX/rust-rt-minimal,TheNe... | src/test/compile-fail/issue-14366.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::path::Path;\n\n#[derive(Debug, PartialEq)]\npub enum Type {\n JSON,\n XML,\n Ruby\n}\n\npub fn from_path(path: &Path) -> Option<Type> {\n match path.to_str() {\n Some(filename) => {\n let extension = fil... | rust | edit | 0 | 3 | mit | 0095298cfd6abe223ddf6d75216c030dfd4b118d | jmacdonald/scribe | src/buffer/type_detection.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate rusoto_mock;\n\nuse crate::generated::{CloudFront, CloudFrontClient, ListDistributionsRequest};\n\nuse rusoto_core::Region;\nuse self::rusoto_mock::*;\n\n#[test]\nfn should_list_distributions() {\n let body = MockResponseReade... | rust | edit | 0 | 1 | mit | c07645ef058868bcd824487caa7536ec99660abc | rusoto/rusoto,DualSpark/rusoto,rusoto/rusoto,DualSpark/rust-aws,DualSpark/rust-aws,DualSpark/rusoto,rusoto/rusoto,DualSpark/rusoto,DualSpark/rust-aws | rusoto/services/cloudfront/src/custom/custom_tests.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n\nuse std::cmp::PartialEq;\n\n//\n\npub fn append_vectors_once<'a, T : PartialEq + Copy, F : FnMut(T)>( dst : &'a mut Vec<T>, src : &'a Vec<Vec<T>>, on_evaluate : Option<F> ) -> &'a mut Vec<T>\n{\n if on_evaluate.is_none()\n {\n for vec ... | rust | edit | 0 | 5 | mit | 125c44cf7948a642859e51a9ecc3dbd8541166d6 | Wandalen/wTools,Wandalen/wTools | rust/wtools/vector.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse ::helper::*;\nuse ::Fake;\n\npub trait PhoneNumber {\n fn phone_number() -> String;\n fn phone_number_with_format<S: Into<String>>(format: S) -> String;\n fn cell_number() -> String;\n}\n\nimpl<T: Fake> PhoneNumber for T {\n #... | rust | edit | 0 | 2 | apache-2.0 | e2b375822083cfbe3925ed50bed3f25b72e5d1a6 | cksac/fake-rs | src/faker/phone_number.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![doc(html_favicon_url = \"https://www.ruma.io/favicon.ico\")]\n#![doc(html_logo_url = \"https://www.ruma.io/images/logo.png\")]\n//! (De)serializable types for the [Matrix Server-Server API][federation-api].\n//! These types are used by ser... | rust | edit | 1 | 0 | mit | f7ed9c5c446c6ec9b29c05291433f93a50ea1f37 | ruma/ruma | crates/ruma-federation-api/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate byteorder;\n\npub mod ber;\npub mod error;\n\nuse ber::common;\nuse ber::types::ASNType;\n\npub type Result<T> = std::result::Result<T, error::LDAPError>;\n\npub fn build_envelope(msgid: i32, protocolOp: common::Tag, controls: Op... | rust | edit | 1 | 5 | apache-2.0 | 3c58b124a8ad6b84a3082844fa33833cd6fc3c82 | inejge/ldap3,inejge/ldap3,inejge/rust-ldap,Dean4Devil/rust-ldap,dequbed/rust-ldap | protocol/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Extended attribute support\npub mod xattr;\n\n// Git support\n\n#[cfg(feature=\"git\")] mod git;\n#[cfg(feature=\"git\")] pub use self::git::Git;\n\n#[cfg(not(feature=\"git\"))] pub struct Git;\n#[cfg(not(feature=\"git\"))] use std::path::... | rust | edit | 0 | 1 | mit | c2d42e7d84a477edb1fce1aea8dfa15884bf6b99 | ogham/exa,ogham/exa | src/fs/feature/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::str;\nuse std::path::Path;\nuse std::process::{self, Command};\n\nextern crate capnpc;\n\nfn main() {\n\n // CAPNP_INCLUDE_DIR=$(shell dirname $(shell which capnp))/../include\n\n let prefix = {\n let output = Command::n... | rust | edit | 0 | 2 | mit | 953cd5c4896559e714d5cb454541737fc0d354b3 | dwrensha/capnp-rpc-rust,tempbottle/capnproto-rust,placrosse/capnproto-rust,dwrensha/capnproto-rust,dwrensha/capnp-rpc-rust | build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate perl_sys;\n\nmod context;\nmod pushable;\nmod handle;\nmod scalar;\n\n#[macro_use]\nmod macros;\n\npub mod raw {\n pub use perl_sys::types::*;\n pub use perl_sys::funcs::*;\n pub use perl_sys::consts::*;\n}\n\npub use co... | rust | edit | 1 | 0 | bsd-2-clause | 2a5d18339e0fe3095a55143b8b679446f8a1e9c0 | vickenty/perl-xs,vickenty/perl-xs | src/lib.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 | 1 | apache-2.0 | 4d7b930d886812a0b91227879d831ead98f1c5d3 | GBGamer/rust,aidancully/rust,graydon/rust,GBGamer/rust,aidancully/rust,aidancully/rust,GBGamer/rust,GBGamer/rust,graydon/rust,GBGamer/rust,graydon/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,GBGamer/rust | src/librustc_back/target/arm_linux_androideabi.rs | rejected_duplicate | Near-duplicate of sample 120197 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n/// Download from a URL to a path\n#[cfg(feature = \"request\")]\npub async fn download<P: AsRef<std::path::Path>>(url: &str, path: P) -> eyre::Result<()> {\n use std::{fs::File, io};\n\n let response = reqwest::get(url).await?;\n le... | rust | edit | 0 | 5 | apache-2.0 | e41a666708fc40010de026909d78ac9c95779648 | stencila/stencila,stencila/stencila,stencila/stencila,stencila/stencila,stencila/stencila,stencila/stencila,stencila/stencila | rust/stencila/src/utils/http.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\npub struct Handler;\n\nimpl Handler {\n pub unsafe fn new() -> Handler {\n Handler\n }\n}\n\npub unsafe fn init() {}\n\npub unsafe fn cleanup() {}\n\n```\n\nApply this change: Remove stack overflow handler stub for wasm."
},
... | rust | edit | 0 | 1 | apache-2.0 | ec8275c364493b938357a3615216e3f30c60a443 | aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust | src/libstd/sys/wasm/stack_overflow.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate tera;\n\nuse std::path::PathBuf;\n\nuse super::serde::Serialize;\nuse super::{TemplateInfo, TEMPLATE_DIR};\n\nlazy_static! {\n static ref TERA: tera::Tera = {\n let path: PathBuf = [&*TEMPLATE_DIR, \"**\", \"*.tera\"].i... | rust | edit | 0 | 5 | apache-2.0 | 5540201236d923008d57929f403d55c58ef0a696 | impowski/Rocket,gsquire/Rocket,antonpirker/Rocket,shssoichiro/Rocket,antonpirker/Rocket,shssoichiro/Rocket,gsquire/Rocket,impowski/Rocket,impowski/Rocket,antonpirker/Rocket,shssoichiro/Rocket,gsquire/Rocket | contrib/src/templates/tera_templates.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse Queriable;\nuse db_result::DbResult;\nuse types::{NativeSqlType, FromSqlRow};\n\nuse std::marker::PhantomData;\n\npub struct Cursor<ST, T> {\n current_row: usize,\n db_result: DbResult,\n _marker: PhantomData<(ST, T)>,\n}\n\nimpl... | rust | edit | 2 | 3 | apache-2.0 | 24a315065dd3a7a9faefc8cf4a0137dcde7b61df | cascalheira/diesel,sgrif/diesel,sgrif/diesel,diesel-rs/diesel,SoftwareWarlock/diesel,diesel-rs/diesel,tohou/diesel,SoftwareWarlock/diesel,mcasper/diesel,cascalheira/diesel,mcasper/diesel,tohou/diesel | yaqb/src/connection/cursor.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![doc(hidden)]\n\nmacro_rules! doc_comment {\n ($x:expr, $($tt:tt)*) => {\n #[doc = $x]\n $($tt)*\n };\n}\n\nmacro_rules! int_module {\n ($T:ident) => (int_module!($T, #[stable(feature = \"rust1\", since = \"1.0.0\")])... | rust | edit | 2 | 0 | apache-2.0 | 4ddf66187aeca3ad1d44e239c794ecf4be95c5bf | aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust | src/libcore/num/int_macros.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![no_std]\n\npub mod buttons;\npub mod console;\npub mod led;\npub mod nfc;\npub mod result;\npub mod rng;\npub mod timer;\npub mod usb_ctap_hid;\npub mod util;\n\n```\n\nApply this change: Hide NFC behind feature flag"
},
{
"role": ... | rust | edit | 1 | 0 | apache-2.0 | a53569007d115252c6afea9ca014cb400974dade | google/OpenSK,google/OpenSK,google/OpenSK | third_party/libtock-drivers/src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::slice;\n\nuse binding::vm::init;\nuse class::object::Object;\nuse types::{Argc, Value};\n\nuse class::traits::RawObject;\n\npub struct VM;\n\nimpl VM {\n pub fn init() {\n init();\n }\n\n pub fn parse_arguments(argc: ... | rust | edit | 0 | 1 | mit | 19c3e1e39a9ddc929dd3acbbed03a145770974f2 | d-unseductable/ruru | src/class/vm.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![allow(missing_docs)] // for downcast.\n\nuse downcast_rs::Downcast;\nuse na::RealField;\n\nuse crate::object::BodySet;\nuse crate::solver::IntegrationParameters;\n\n/// The handle of a force generator.\npub type ForceGeneratorHandle = usiz... | rust | edit | 0 | 0 | bsd-3-clause | 4d32e1c030d29d3a9c0ed4e5e6379acaef29f9b8 | sebcrozet/nphysics,sebcrozet/nphysics | src/force_generator/force_generator.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n\nextern crate mprovision;\nextern crate clap;\n\nuse std::fs;\nuse clap::{Arg, App, AppSettings, SubCommand};\n\nfn main() {\n let count_subcommand = SubCommand::with_name(\"count\")\n .about(\"Counts provisioning profiles in a dir... | rust | edit | 0 | 3 | mit | ca2171f1c94763b777791ca1a9c55a9179f96ce0 | zummenix/mprovision | src/main.rs | rejected_duplicate | Near-duplicate of sample 119762 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate anybar;\n\nuse anybar::*;\n\nfn main() {\n println!(\"Knock knock!\");\n\n if let Ok(is_open) 0 get_buerostatus() {\n if is_open { println!(\"Who's there?\"); }\n else { println!(\"...\"); }\n }\n}\n\n```\n... | rust | edit | 0 | 3 | mit | f39a09507a8766993d784733549918e533f2a960 | Feliix42/buerostatus-rs | examples/knock_knock.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(globs)]\n\nextern crate rdb;\nuse std::os;\nuse std::io::{BufferedReader, File};\n\nfn main() {\n let args = os::args();\n if args.len() == 1 {\n println!(\"Usage: {} [list of files]\", args[0]);\n panic!();\n ... | rust | edit | 0 | 2 | mit | 02dab094e2be3428ab3702b609bcd218b89783c7 | kbknapp/rdb-rs,badboy/rdb-rs,badboy/rdb-rs,badboy/rdb-rs,kbknapp/rdb-rs,kbknapp/rdb-rs | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n/*!\nTest supports module.\n\n*/\nuse glutin;\nuse glium::{mod, DisplayBuild};\n\nuse std::os;\n\n/// Builds a headless display for tests.\npub fn build_display() -> glium::Display {\n if os::getenv(\"HEADLESS_TESTS\").is_some() {\n ... | rust | edit | 1 | 2 | apache-2.0 | 8fc45b446dd8e13feca154d03bc83499780dd100 | glium/glium,TyOverby/glium,cpjreynolds/glium,acolley/glium,msiglreith/glium,rozaliev/glium,caldwell/glium,carbidegames/glium,nicokoch/glium,bvssvni/glium,sdotz/glium,christopheraugustus/glium,binsoftware/glium,tomaka/glium | tests/support/mod.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// Copyright 2020 Google LLC\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// https://www.apa... | rust | edit | 0 | 2 | apache-2.0 | 02676f5d21524255b15fe69aeffe1194f994fe9c | google/autocxx,google/autocxx,google/autocxx,google/autocxx | engine/src/conversion/codegen_rs/impl_item_creator.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::iter::repeat;\n\nuse set1::challenge2::fixed_xor;\nuse set1::utils::bytes_to_hex;\n\nfn repeating_xor(text: &[u8], key: &[u8]) -> String {\n bytes_to_hex(&fixed_xor(text,\n &(repeat(key)\n ... | rust | edit | 0 | 1 | mit | 793b69091bb9a373c4f81f0345ad0e70fe41d8b0 | rkuska/cryptopals-rs | src/set1/challenge5.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::env;\nuse std::io;\nuse std::io::Write;\n\n#[macro_use]\nmod macros;\n\nmod buffered_iterator;\nmod ast;\nmod scanning;\nmod parsing;\nmod running;\n\nuse ast::*;\n\nfn main() {\n\tfor arg in env::args() {\n\t\tprintln!(\"{}\", arg);... | rust | edit | 2 | 4 | mit | 2f8d78dc78e2bd0eee456541d4e57e3f7bd23c6b | dubrowgn/tcalc,dubrowgn/tcalc | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(phase)]\n\n#[phase(plugin)]\nextern crate static_fragments;\nextern crate fragments;\n\ntemplate! greeting {\"Hello, [[:name]]!\"}\n\nfn main() {\n let mut template = greeting::new();\n\n //Insert something into the `name` pl... | rust | edit | null | null | mit | 07c47087bbbb08f68bb7338c2aa5b6d1634fb1f0 | Ogeon/static_fragments | examples/placeholders_string.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Crate ruma_client_api contains serializable types for the requests and responses for each\n//! endpoint in the [Matrix](https://matrix.org/) client API specification. These types can be\n//! shared by client and server code.\n\n#![deny(mi... | rust | edit | 2 | 0 | mit | 58d06f82a2ee2d062c6c17b292bde520c088ca65 | ruma/ruma,ruma/ruma-client-api | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse euler;\n\nimport iter::*;\nimport euler::prime;\n\nfn gen_triangles(&trigs: [uint]) {\n alt vec::len(trigs) {\n 0u { trigs = [1u]; }\n x { trigs += [trigs[x - 1u] + x + 1u]; }\n }\n}\n\nfn num_factors(num: u64, primes: pr... | rust | edit | null | null | mit | 35bada57c2025e79ca0057e03daadb7d37e21b78 | gifnksm/ProjectEulerRust,tempbottle/ProjectEulerRust | 0001-0050/prob0012.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse std::env;\nuse std::fs::File;\nuse std::io::Write;\nuse std::iter;\nuse std::path::Path;\n\n/*\n#[doc(hidden)]\n#[macro_export]\nmacro_rules! count {\n () => { proc_macro_call_0!() };\n (!) => { proc_macro_call_1!() };\n (!!) => ... | rust | edit | 3 | 2 | apache-2.0 | 7fc8b0bc06f8170e3fc34c95385073648d0379c2 | dtolnay/proc-macro-hack | nested/build.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Common types for receipts.\n\nuse ruma_serde::StringEnum;\n\n/// The type of receipt.\n#[derive(Clone, Debug, PartialOrd, Ord, PartialEq, Eq, StringEnum)]\npub enum ReceiptType {\n /// m.read\n #[ruma_enum(rename = \"m.read\")]\n ... | rust | edit | 0 | 0 | mit | dd940f810e5a1442cf83377cb006c0b0c01c6c9c | ruma/ruma | crates/ruma-common/src/receipt.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Add functions to load dataset"
},
{
"role": "assistant",
"content": "use std::string::String;\nuse std::collections::HashMap;\nuse std::vec::Vec;\nuse std::fs::{File};\nuse std::env;\nuse std::path::{Path};\nuse std::io::{self, Buf... | rust | new_file | null | null | mit | 46a4e2d0b96b42be2d2f31b5a14863891f093f26 | yuttie/tilda | src/main.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![feature(plugin, core, test)]\n#![plugin(speculate)]\n\nextern crate test;\n\nspeculate! {\n bench \"noop\" |b| {\n b.iter(|| ());\n }\n\n describe \"xor\" {\n context \"0 to 1000\" {\n before {\n ... | rust | edit | 0 | 0 | apache-2.0 | 99bf36c97713c699a421e627827c09bad475c04c | cmr/speculate.rs | benches/basic.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n//! Provides the CLI option parser\n//!\n//! Used to parse the argv/config file into a struct that\n//! the server can consume and use as configuration data.\n\nuse docopt::Docopt;\n\nstatic USAGE: &'static str = \"\nUsage: statsd [options]\n... | rust | edit | 1 | 1 | mit | 6217b4a5dd234d798dc05a476ec4397b39fba58d | markstory/rust-statsd-server,markstory/rust-statsd-server | src/cli.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse vector::Vec3;\nuse ray::Ray;\n\n#[derive(Debug, Copy, Clone, PartialEq)]\npub struct HitRecord {\n pub t : f64,\n pub p : Vec3,\n pub normal : Vec3,\n}\n\nimpl HitRecord {\n pub fn new(time : f64, point : Vec3, norm : Vec3) -> HitReco... | rust | edit | 0 | 1 | mit | 0a7e050447536e74e9ea607ce06da4a391b6b870 | corragon/rust-raytracer | src/hitable.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse once_cell::sync::Lazy;\n\n#[allow(dead_code)]\n#[derive(PartialEq, Clone)]\npub enum PlatformType {\n Unknown,\n OSX,\n Linux,\n Arch,\n Alpine,\n}\n\npub fn is_alpine() -> bool {\n *PLATFORM == PlatformType::Alpine\n}\n... | rust | edit | 0 | 3 | mit | 2f7f8ebcab920c8455826c48bd19701bfb8bcbd1 | nuimk/nmk,nuimk/nmk,nuimk/nmk,nuimk/nmk | nmk/src/nmk/platform.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate gitlab_api as gitlab;\n\nuse std::env;\n#[macro_use]\nextern crate log;\nextern crate env_logger;\n\n\nfn main() {\n env_logger::init().unwrap();\n info!(\"starting up\");\n\n let hostname = match env::var(\"GITLAB_HOSTN... | rust | edit | 0 | 3 | apache-2.0 | 408432e589e07c873e2fd3c8075c4149d371543c | nbigaouette/gitlab-api-rs,nbigaouette/gitlab-api-rs | examples/list_groups.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate kiss_ui;\n\nuse kiss_ui::button::Button;\nuse kiss_ui::container::Horizontal;\nuse kiss_ui::callback::OnClick;\nuse kiss_ui::dialog::Dialog;\nuse kiss_ui::text::Label;\n\nfn main() {\n kiss_ui::show_gui(||\n Dialog::new... | rust | edit | 0 | 2 | mit | 9506c5c963fd880b4fcd006246c700b5e7f52ed9 | tempbottle/kiss-ui,cybergeek94/kiss-ui,KISS-UI/kiss-ui,KISS-UI/kiss-ui,tempbottle/kiss-ui,cybergeek94/kiss-ui | examples/button_test.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![cfg(not(miri))]\n\n#[rustversion::not(nightly)]\n#[ignore]\n#[test]\nfn test_backtrace() {}\n\n#[rustversion::nightly]\n#[test]\nfn test_backtrace() {\n use anyhow::anyhow;\n\n let error = anyhow!(\"oh no!\");\n let _ = error.back... | rust | edit | 0 | 1 | apache-2.0 | 2c8f71bda431e6eb80366798ced49c7a38883725 | dtolnay/anyhow | tests/test_backtrace.rs | rejected_duplicate | Near-duplicate of sample 120815 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#[deriving(PartialEq, Show)]\r\npub struct ObjectId {\r\n pub hash: &'static str,\r\n bytes: Vec<u8>\r\n}\r\n\r\nimpl ObjectId {\r\n pub fn new(hash: &'static str) -> ObjectId {\r\n ObjectId {\r\n hash: hash,\r\n ... | rust | edit | 1 | 1 | mit | 7f5b5fdb1ba8339aac46144c782bf6848a7815b6 | kaisellgren/rust_git | src/object_id.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate document;\n\nuse std::cmp::min;\nuse std::io::File;\nuse std::io::BufferedWriter;\nuse std::io::stdio::stdout_raw;\n\nuse document::parser::Parser;\n\nfn pretty_error(xml: &str, position: uint) -> &str {\n let s = xml.slice_fr... | rust | edit | 0 | 3 | mit | 10a3bd31222f34e990dd7016acb4e3ee0e330483 | shepmaster/sxd-document,shepmaster/sxd-document | src/bin/open.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate gauge_rs;\n\nuse std::env;\n\nfn help() {\n println!(\"Rust language runner for Gauge. Version: {}\",\n gauge_rs::version());\n println!(\"\\nAvailable commands:\");\n println!(\" --init - Create a new Gauge ... | rust | edit | 0 | 3 | mit | be509f499b0281b32ba9bc8ab1b97766f29ee5a9 | getgauge-contrib/gauge-rs,getgauge-contrib/gauge-rs,kaustavdm/gauge-rs,kaustavdm/gauge-rs | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nimport dvec::dvec;\n\nstruct c1<T: copy> {\n let x: T;\n new(x: T) {self.x = x;}\n\n fn f1(x: T) {}\n}\n\nimpl<T: copy> c1<T> {\n fn f2(x: T) {}\n}\n\n\nfn main() {\n c1::<int>(3).f1(4);\n c1::<int>(3).f2(4);\n}\n\n```\n\nApply ... | rust | edit | null | null | apache-2.0 | adf9fa229fbf9da048c766ec966d6d7c0babb5c9 | ruud-v-a/rust,quornian/rust,aepsil0n/rust,XMPPwocky/rust,stepancheg/rust-ide-rust,philyoon/rust,hauleth/rust,pshc/rust,michaelballantyne/rust-gpu,nwin/rust,pelmers/rust,nwin/rust,mvdnes/rust,0x73/rust,barosl/rust,robertg/rust,sae-bom/rust,jroesch/rust,nham/rust,servo/rust,mitsuhiko/rust,andars/rust,aidancully/rust,XMPP... | src/test/run-pass/issue-2445.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nuse getopts;\n\npub fn run(args: Vec<String>) -> Result<String, String> {\n let options = getopts::Options::new();\n let matches = match options.parse(args.iter().skip(1)) {\n Ok(matches) => matches,\n Err(fail) => return ... | rust | edit | 3 | 6 | mit | 132b84eeb4b951bb88376d170b9110636efa77bf | kbknapp/corectl | src/cli.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 | 0 | apache-2.0 | 4b3c35509b7bd75c0b4712bb45440955d997ae75 | aidancully/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,GBGamer/rust,aidancully/rust,GBGamer/rust,graydon/rust,GBGamer/rust,graydon/rust,graydon/rust,graydon/rust,graydon/rust,aidancully/rust,GBGamer/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust | src/librustc_mir/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n\nextern crate mio_websocket;\nextern crate env_logger;\n\nuse std::net::SocketAddr;\n\nuse mio_websocket::interface::*;\n\nfn main() {\n env_logger::init().unwrap();\n\n let mut ws = WebSocket::new(\"0.0.0.0:10000\".parse::<SocketAddr>... | rust | edit | 0 | 4 | mit | 1686117153d692d9482c4d4c16aaa01cea1672dd | nbaksalyar/rust-chat | src/main.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\nextern crate asn1_parse;\n#[macro_use]\nextern crate nom;\nextern crate argparse;\n\nuse std::io;\nuse std::io::Read;\nuse std::fs;\nuse std::path::Path;\nuse asn1_parse::parse::spec::asn1_spec;\nuse argparse::{ArgumentParser, StoreOption};\n... | rust | edit | 0 | 2 | apache-2.0 | e840c69d8b7b02ef5b1a4995ac0214c3a9df232a | keeperofdakeys/asn1-parse,keeperofdakeys/asn1-parse | utils/src/asn1-spec-dump.rs | accepted | null | true |
[
{
"role": "user",
"content": "Write rust code for the following: Implement the `peek` method for the `PeekableReader`\n\nThe peek method returns an IoResult that represents the result obtained\nfrom the underlying `Reader` that is wrapped by the `PeekableReader`.\n\nThis result is returned on all subsequent... | rust | new_file | 1 | 2 | mit | 046c9de6f6203579fe5bcfdfd5d0a1319b596827 | mlalic/peekable-reader-rs | src/lib.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n\n#[inline]\npub fn alpha(term: u8) -> bool {\n\t(term >= 0x41 && term <= 0x5A) || (term >= 0x61 && term <= 0x7A)\n}\n\n#[inline]\npub fn digit(term: u8) -> bool {\n\tterm >= 0x30 && term <= 0x39\n}\n\n#[inline]\npub fn alphanum(term: u8) -> ... | rust | edit | 0 | 6 | mit | 9d93cf61d5a9473f6fd54e30b8943d4d38496d72 | J-F-Liu/pom | src/char_class.rs | accepted | null | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n#![cfg(feature=\"inline-systemd\")]\nextern crate specinfra;\n\nuse specinfra::backend;\n\n#[test]\nfn service_resource_with_inline_provider() {\n let b = backend::direct::Direct::new();\n let s = specinfra::new(&b).unwrap();\n test_... | rust | edit | 0 | 1 | mit | c038da2f6b1de2780e02fd1850ab25626225ca7b | libspecinfra/specinfra,libspecinfra/specinfra | tests/service.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 | 5 | 1 | mit | fa0694dd53583bae9b534bde6429a3135617b91b | juliangrosshauser/dining_philosophers | src/main.rs | rejected_lint | Too many lint violations: 5 | true |
[
{
"role": "user",
"content": "Here is the current file:\n```rust\n// build-pass\n\n#![allow(incomplete_features)]\n#![feature(const_generics)]\n\nstruct Bug<const S: &'static str>;\n\nfn main() {\n let b: Bug::<{\n unsafe {\n std::mem::transmute::<&[u8], &str>(&[0xC0, 0xC1, 0xF5])\n ... | rust | edit | null | null | apache-2.0 | 4641d2e6aa990d3fb6730a3208e9fd857f52eb33 | graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,graydon/rust,graydon/rust,aidancully/rust,graydon/rust,aidancully/rust,aidancully/rust,graydon/rust,aidancully/rust | src/test/ui/issues/issue-75763.rs | rejected_syntax | Syntax error detected by tree-sitter | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.