Skip to content

Commit f97d501

Browse files
committed
we have now the CI ensure all doc strings remain formatted
1 parent bb1b55c commit f97d501

File tree

128 files changed

+966
-870
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+966
-870
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
jobs:
9+
fmt:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
- name: Install Rust nightly
15+
run: rustup toolchain install nightly
16+
17+
- name: Run rustfmt (nightly)
18+
run: cargo +nightly fmt --all -- --config format_code_in_doc_comments=true

datafusion-examples/examples/advanced_parquet_index.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ use url::Url;
121121
/// │ ╚═══════════════════╝ │ 1. With cached ParquetMetadata, so
122122
/// └───────────────────────┘ the ParquetSource does not re-read /
123123
/// Parquet File decode the thrift footer
124-
///
125124
/// ```
126125
///
127126
/// Within a Row Group, Column Chunks store data in DataPages. This example also

datafusion-examples/examples/external_dependency/query-aws-s3.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use url::Url;
2828
///
2929
/// - AWS_ACCESS_KEY_ID
3030
/// - AWS_SECRET_ACCESS_KEY
31-
///
3231
#[tokio::main]
3332
async fn main() -> Result<()> {
3433
let ctx = SessionContext::new();

datafusion-examples/examples/flight/flight_sql_server.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ macro_rules! status {
6868
///
6969
/// Based heavily on Ballista's implementation: https://github.com/apache/datafusion-ballista/blob/main/ballista/scheduler/src/flight_sql.rs
7070
/// and the example in arrow-rs: https://github.com/apache/arrow-rs/blob/master/arrow-flight/examples/flight_sql_server.rs
71-
///
7271
#[tokio::main]
7372
async fn main() -> Result<(), Box<dyn std::error::Error>> {
7473
env_logger::init();

datafusion-examples/examples/parquet_index.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ use url::Url;
9999
/// Thus some parquet files are │ │
100100
/// "pruned" and thus are not └─────────────┘
101101
/// scanned at all Parquet Files
102-
///
103102
/// ```
104103
///
105104
/// [`ListingTable`]: datafusion::datasource::listing::ListingTable

datafusion-examples/examples/sql_query.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ use std::sync::Arc;
3232
///
3333
/// [`query_memtable`]: a simple query against a [`MemTable`]
3434
/// [`query_parquet`]: a simple query against a directory with multiple Parquet files
35-
///
3635
#[tokio::main]
3736
async fn main() -> Result<()> {
3837
query_memtable().await?;

datafusion-examples/examples/thread_pools.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ impl CpuRuntime {
342342
/// message such as:
343343
///
344344
/// ```text
345-
///A Tokio 1.x context was found, but IO is disabled.
345+
/// A Tokio 1.x context was found, but IO is disabled.
346346
/// ```
347347
pub fn handle(&self) -> &Handle {
348348
&self.handle

datafusion/common/src/config.rs

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use hex;
5555
/// /// Field 3 doc
5656
/// field3: Option<usize>, default = None
5757
/// }
58-
///}
58+
/// }
5959
/// ```
6060
///
6161
/// Will generate
@@ -1139,36 +1139,35 @@ impl ConfigOptions {
11391139
/// # Example
11401140
/// ```
11411141
/// use datafusion_common::{
1142-
/// config::ConfigExtension, extensions_options,
1143-
/// config::ConfigOptions,
1142+
/// config::ConfigExtension, config::ConfigOptions, extensions_options,
11441143
/// };
1145-
/// // Define a new configuration struct using the `extensions_options` macro
1146-
/// extensions_options! {
1147-
/// /// My own config options.
1148-
/// pub struct MyConfig {
1149-
/// /// Should "foo" be replaced by "bar"?
1150-
/// pub foo_to_bar: bool, default = true
1144+
/// // Define a new configuration struct using the `extensions_options` macro
1145+
/// extensions_options! {
1146+
/// /// My own config options.
1147+
/// pub struct MyConfig {
1148+
/// /// Should "foo" be replaced by "bar"?
1149+
/// pub foo_to_bar: bool, default = true
11511150
///
1152-
/// /// How many "baz" should be created?
1153-
/// pub baz_count: usize, default = 1337
1154-
/// }
1155-
/// }
1151+
/// /// How many "baz" should be created?
1152+
/// pub baz_count: usize, default = 1337
1153+
/// }
1154+
/// }
11561155
///
1157-
/// impl ConfigExtension for MyConfig {
1156+
/// impl ConfigExtension for MyConfig {
11581157
/// const PREFIX: &'static str = "my_config";
1159-
/// }
1158+
/// }
11601159
///
1161-
/// // set up config struct and register extension
1162-
/// let mut config = ConfigOptions::default();
1163-
/// config.extensions.insert(MyConfig::default());
1160+
/// // set up config struct and register extension
1161+
/// let mut config = ConfigOptions::default();
1162+
/// config.extensions.insert(MyConfig::default());
11641163
///
1165-
/// // overwrite config default
1166-
/// config.set("my_config.baz_count", "42").unwrap();
1164+
/// // overwrite config default
1165+
/// config.set("my_config.baz_count", "42").unwrap();
11671166
///
1168-
/// // check config state
1169-
/// let my_config = config.extensions.get::<MyConfig>().unwrap();
1170-
/// assert!(my_config.foo_to_bar,);
1171-
/// assert_eq!(my_config.baz_count, 42,);
1167+
/// // check config state
1168+
/// let my_config = config.extensions.get::<MyConfig>().unwrap();
1169+
/// assert!(my_config.foo_to_bar,);
1170+
/// assert_eq!(my_config.baz_count, 42,);
11721171
/// ```
11731172
///
11741173
/// # Note:

datafusion/common/src/dfschema.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,10 @@ pub type DFSchemaRef = Arc<DFSchema>;
5656
/// an Arrow schema.
5757
///
5858
/// ```rust
59-
/// use datafusion_common::{DFSchema, Column};
6059
/// use arrow::datatypes::{DataType, Field, Schema};
60+
/// use datafusion_common::{Column, DFSchema};
6161
///
62-
/// let arrow_schema = Schema::new(vec![
63-
/// Field::new("c1", DataType::Int32, false),
64-
/// ]);
62+
/// let arrow_schema = Schema::new(vec![Field::new("c1", DataType::Int32, false)]);
6563
///
6664
/// let df_schema = DFSchema::try_from_qualified_schema("t1", &arrow_schema).unwrap();
6765
/// let column = Column::from_qualified_name("t1.c1");
@@ -77,12 +75,10 @@ pub type DFSchemaRef = Arc<DFSchema>;
7775
/// Create an unqualified schema using TryFrom:
7876
///
7977
/// ```rust
80-
/// use datafusion_common::{DFSchema, Column};
8178
/// use arrow::datatypes::{DataType, Field, Schema};
79+
/// use datafusion_common::{Column, DFSchema};
8280
///
83-
/// let arrow_schema = Schema::new(vec![
84-
/// Field::new("c1", DataType::Int32, false),
85-
/// ]);
81+
/// let arrow_schema = Schema::new(vec![Field::new("c1", DataType::Int32, false)]);
8682
///
8783
/// let df_schema = DFSchema::try_from(arrow_schema).unwrap();
8884
/// let column = Column::new_unqualified("c1");
@@ -94,13 +90,15 @@ pub type DFSchemaRef = Arc<DFSchema>;
9490
/// Use the `Into` trait to convert `DFSchema` into an Arrow schema:
9591
///
9692
/// ```rust
93+
/// use arrow::datatypes::{Field, Schema};
9794
/// use datafusion_common::DFSchema;
98-
/// use arrow::datatypes::{Schema, Field};
9995
/// use std::collections::HashMap;
10096
///
101-
/// let df_schema = DFSchema::from_unqualified_fields(vec![
102-
/// Field::new("c1", arrow::datatypes::DataType::Int32, false),
103-
/// ].into(),HashMap::new()).unwrap();
97+
/// let df_schema = DFSchema::from_unqualified_fields(
98+
/// vec![Field::new("c1", arrow::datatypes::DataType::Int32, false)].into(),
99+
/// HashMap::new(),
100+
/// )
101+
/// .unwrap();
104102
/// let schema = Schema::from(df_schema);
105103
/// assert_eq!(schema.fields().len(), 1);
106104
/// ```

datafusion/common/src/diagnostic.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ use crate::Span;
3030
/// ```rust
3131
/// # use datafusion_common::{Location, Span, Diagnostic};
3232
/// let span = Some(Span {
33-
/// start: Location{ line: 2, column: 1 },
34-
/// end: Location{ line: 4, column: 15 }
33+
/// start: Location { line: 2, column: 1 },
34+
/// end: Location {
35+
/// line: 4,
36+
/// column: 15,
37+
/// },
3538
/// });
3639
/// let diagnostic = Diagnostic::new_error("Something went wrong", span)
3740
/// .with_help("Have you tried turning it on and off again?", None);

0 commit comments

Comments
 (0)