Repository: actix/actix-web
File: actix-web/src/app.rs (Rust)

Code before:
use std::{cell::RefCell, fmt, future::Future, rc::Rc};

use actix_http::{body::MessageBody, Extensions, Request};
use actix_service::{
    apply, apply_fn_factory, boxed, IntoServiceFactory, ServiceFactory, ServiceFactoryExt,
    Transform,
};
use futures_util::future::FutureExt as _;

use crate::{
    app_service::{AppEntry, AppInit, AppRoutingFactory},
    config::ServiceConfig,
    data::{Data, DataFactory, FnDataFactory},
    dev::ResourceDef,
    error::Error,
    resource::Resource,
    route::Route,
    service::{
        AppServiceFactory, BoxedHttpServiceFactory, HttpServiceFactory, ServiceFactoryWrapper,
        ServiceRequest, ServiceResponse,
    },
};

/// The top-level builder for an Actix Web web application.
pub struct App<T> {
    endpoint: T,
    services: Vec<Box<dyn AppServiceFactory>>,
    default: Option<Rc<BoxedHttpServiceFactory>>,
    factory_ref: Rc<RefCell<Option<AppRoutingFactory>>>,
    data_factories: Vec<FnDataFactory>,
    external: Vec<ResourceDef>,
    extensions: Extensions,
}

impl App<AppEntry> {
    /// Create application builder. Application can be configured with a builder-like pattern.
    #[allow(clippy::new_without_default)]
    pub fn new() -> Self {
        let factory_ref = Rc::new(RefCell::new(None));

        App {
            endpoint: AppEntry::new(factory_ref.clone()),
            data_factories: Vec::new(),
            services: Vec::new(),
            default: None,
            factory_ref,
            external: Vec::new(),
            extensions: Extensions::new(),
        }

Review comment (suggestion):
```suggestion
/// The top-level builder for an Actix Web application.
```

Code after:
use std::{cell::RefCell, fmt, future::Future, rc::Rc};

use actix_http::{body::MessageBody, Extensions, Request};
use actix_service::{
    apply, apply_fn_factory, boxed, IntoServiceFactory, ServiceFactory, ServiceFactoryExt,
    Transform,
};
use futures_util::future::FutureExt as _;

use crate::{
    app_service::{AppEntry, AppInit, AppRoutingFactory},
    config::ServiceConfig,
    data::{Data, DataFactory, FnDataFactory},
    dev::ResourceDef,
    error::Error,
    resource::Resource,
    route::Route,
    service::{
        AppServiceFactory, BoxedHttpServiceFactory, HttpServiceFactory, ServiceFactoryWrapper,
        ServiceRequest, ServiceResponse,
    },
};

/// The top-level builder for an Actix Web application.
pub struct App<T> {
    endpoint: T,
    services: Vec<Box<dyn AppServiceFactory>>,
    default: Option<Rc<BoxedHttpServiceFactory>>,
    factory_ref: Rc<RefCell<Option<AppRoutingFactory>>>,
    data_factories: Vec<FnDataFactory>,
    external: Vec<ResourceDef>,
    extensions: Extensions,
}

impl App<AppEntry> {
    /// Create application builder. Application can be configured with a builder-like pattern.
    #[allow(clippy::new_without_default)]
    pub fn new() -> Self {
        let factory_ref = Rc::new(RefCell::new(None));

        App {
            endpoint: AppEntry::new(factory_ref.clone()),
            data_factories: Vec::new(),
            services: Vec::new(),
            default: None,
            factory_ref,
            external: Vec::new(),
            extensions: Extensions::new(),
        }